method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
16523ae6-c3f8-4523-9b1e-d892493088f4 | 4 | private boolean checkValidCodeInput(String code){
int CL = (Integer)this.state.get(CODELENGTH);
if (code.length() != CL) {
return false;
}
int maxDigit = (Integer)this.state.get(MAXDIGIT);
for (char c: code.toCharArray()){
if (c <'0' || c > '0' + maxDigit) {
return false;
}... |
2f040b2a-4dbc-4476-b7c4-c6b093ce9fd8 | 8 | final public void filterExpression() throws ParseException {
/*@bgen(jjtree) filterExpression */
SimpleNode jjtn000 = new SimpleNode(JJTFILTEREXPRESSION);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));
try {
compareEquation();
... |
88f78201-7f58-490d-aa57-660ad3a0f219 | 1 | public static Connection getcon() {
Connection con = null;
try {
Class.forName("org.postgresql.Driver").newInstance();
con = DriverManager.getConnection(url, username, password);
} catch (Exception e) {
System.out.println(e);
}
return con;
... |
4e782aad-b689-47bc-9c93-e2317e7f9262 | 0 | public void reiniciar() {
// TODO Auto-generated method stub
textFieldName.setText("");
textFieldLastName.setText("");
textField_7.setText("");
textField_8.setText("");
textField_9.setText("");
textField_10.setText("");
textField_11.setText("");
textField_12.setText("");
textFiel... |
9a8c9997-f679-4637-8032-8ea99dc1eded | 2 | @Override
public void drop(DropTargetDropEvent dtde) {
if (mDragDockable != null && mDragInsertIndex != -1) {
getDockContainer().stack(mDragDockable, mDragInsertIndex);
dtde.acceptDrop(DnDConstants.ACTION_MOVE);
dtde.dropComplete(true);
} else {
dtde.rejectDrop();
dtde.dropComplete(false);
}
cle... |
f60b7cdc-a224-4f93-835d-308cd0d7aafa | 2 | public final void addElements(ElementGraph[][] E){
for(int x = 0; x< IConfig.LARGEUR_CARTE;x++ ){
for(int y = 0; y< IConfig.HAUTEUR_CARTE;y++ ){
this.add(E[x][y],E[x][y].getGridConstraint());
}
}
} |
6968ee9f-a405-4223-aa05-d33fe38a0ea2 | 5 | public ArrayList<Integer> sortIntegers(ArrayList<Integer> list, int maxDigits) {
int nextPosToSort = 1;
final int base = 10;
int exp = 1;
// Step 1: Perform the sort operation for each digit.
while (nextPosToSort <= maxDigits) {
// Step 1.A: Create buckets for each digit.
ArrayLi... |
303b18a6-1fbf-4ce3-b0a2-39f359ca68bd | 4 | public void changeDirection(String instruction) {
Set<String> instructions = new HashSet<String>(Arrays.asList(new String[]{ "L", "R" }));
if (instruction == null) {
throw new IllegalArgumentException("Instruction can't be NULL");
} else if (!instructions.contains(instruction)) {
throw new Illeg... |
35e1fd64-6c9a-4589-9c5d-9fe6d73a9f57 | 1 | @AfterTest
public void tearDown() throws Exception {
driver.quit();
String verificationErrorString = verificationErrors.toString();
if (!"".equals(verificationErrorString)) {
fail(verificationErrorString);
}
} |
27704f4d-4f77-41ca-9c56-215c8ff6ed25 | 7 | public static String stRetValDes (int expVal,int actVal,String functionName,String flow,HashMap<String, String> data)
{
String status;
status=null;
try {
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docBuilderFactory.n... |
6d1286a0-c57c-4082-8d5c-04acdc931633 | 3 | private void createAndShowGUI() {
//Create and set up the window.
try {
for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
... |
b65bca61-793a-4cb0-b689-01297f0182ad | 9 | public static String longestCommonSubsequence(String str1, String str2) {
int[][] lcsMap = new int[str1.length() + 1][str2.length() + 1];
for(int i = 0; i <= str1.length(); i++) {
lcsMap[i][0] = 0;
}
for(int j = 0; j <= str2.length(); j++) {
lcsMap[0][j] = 0;
}
for(int i = 1; i <= str1.length... |
eb3cdddb-bf4d-416d-bd58-2c1970ea9fcb | 0 | public ParticipantItf makeParticipant() {
// Construct the AutoBean
AutoBean<ParticipantItf> car = factory.part();
// Return the Book interface shim
return car.as();
} |
f79b16d5-42fa-43a1-be98-6269d65e52ca | 1 | private static int findLength(Node h){
int l = 0;
while(h!=null){
l++;
h=h.next;
}
return l;
} |
a92d6b9c-3a67-48d1-97b0-b1c91655092b | 8 | void buildInstances(Document doc, String sName) throws Exception {
NodeList nodelist;
// Get the name of the network
nodelist = selectAllNames(doc);
if (nodelist.getLength() > 0) {
sName = ((CharacterData) (nodelist.item(0).getFirstChild())).getData();
}
// Process va... |
a347d4eb-0f36-40ec-9574-4ec7ef363169 | 1 | public void move(int newx, int newy, int newz) {
if (_level == null)
return;
_level.setTile(Block.getBlock((byte)0), _x, _y, _z, _server);
Player.GlobalBlockChange((short)_x, (short)_y, (short)_z, Block.getBlock((byte)0), _level, _server, false);
setPos(newx, newy, newz);
_level.setTile(this, _x, _y, _z, ... |
aea35748-f84c-4029-9629-48baf133c52f | 9 | public Map<Integer, String> getBaseURLs() {
if (baseURLs != null && baseURLs.size() > 0) {
return baseURLs;
}
BufferedReader reader = null;
baseURLs = new HashMap<Integer, String>();
try {
reader = new BufferedReader(new InputStreamReader(new URL(BASE_URL_INFO).openStream()));
String line = null;
... |
fbb57041-33e7-491e-8363-abb341b7830f | 4 | public SimpleSpectralAccessInputParameters(final DataSetApplication datasetAppVal, final Request requestVal, final Context contextVal, final ResourceModel resourceModelVal) {
this.datasetApp = datasetAppVal;
this.context = contextVal;
this.request = requestVal;
this.resourceModel = resourceModelVal;
... |
7e27a8b8-1279-4844-a1e9-14f226039675 | 2 | private void isGreaterThanInteger(Integer param, Object value) {
if (value instanceof Integer) {
if (!(param > (Integer) value)) {
throw new IllegalStateException("Integer is not greater than supplied value.");
}
} else {
throw new IllegalArgumentException();
}
} |
78c4d091-da83-4bee-846c-61a605447cbd | 3 | public String getDisplayString(Class retType, String name,
Class[] paramTypes)
{
StringBuffer b = new StringBuffer();
b.append("<html>");
if (retType != null)
appendTypeName(b, retType.getName());
b.append(" <font color='blue'>");
... |
fc05c7c1-56a1-416c-af3a-9566a5f846e6 | 0 | public ApiHandler() {
this.addRtnCode(200, "ok");
} |
0a202b3b-b3fb-49e6-8823-d9c09756cf35 | 4 | void startAnimationTimer() {
final Display display = parent.getDisplay();
display.timerExec(TIMER, new Runnable() {
public void run() {
if (canvas.isDisposed()) return;
int timeout = TIMER;
GraphicsTab tab = getTab();
if (tab instanceof AnimatedGraphicsTab) {
AnimatedGraphicsTab animTab = (AnimatedG... |
0ae435ad-6493-4fc1-ad53-02726e539d5f | 1 | @Override
protected JPanel createButtonPanel() {
JButton cancel = new JButton("Storno");
cancel.addActionListener( new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
actionCancel();
}
});
JButton save = n... |
b40c5761-08fd-45d8-b53a-cc65b12cd2b9 | 9 | public String convert(String s, int nRows) {
if (s == null || s.length() == 0 || nRows <= 0)
return "";
if (nRows == 1)
return s;
StringBuilder res = new StringBuilder();
int size = 2 * nRows - 2;
for (int i = 0; i < nRows; i++) {
for (int j = i; j < s.length(); j += size) {
res.append(s.charAt(j... |
8c77900f-dc97-47c9-a415-3fe9d6e92d1c | 5 | private void paintReverse(Graphics g,
int clipx, int clipy, int clipwidth, int clipheight,
Object component, boolean enabled) {
if (component != null) {
Rectangle bounds = getRectangle(component, "bounds");
if ((clipx < bounds.x) ||
(clipx + clipwidth > bounds.x + bounds.width) ||
(clipy < bound... |
8578d57e-bb1c-4a79-a726-412a1ccd72c4 | 8 | private GatewayDevice parseMSearchReply(byte[] reply) {
GatewayDevice device = new GatewayDevice();
String replyString = new String(reply);
StringTokenizer st = new StringTokenizer(replyString, "\n");
while (st.hasMoreTokens()) {
String line = st.nextToken().trim();
... |
ded72827-46a4-4cb2-ad2c-06351fbbf76e | 0 | @RequestMapping(value = "/room-event-video-list/{roomEventId}", method = RequestMethod.GET)
@ResponseBody
public CreativeMaterialListResponse roomEventVideoList(
@PathVariable(value = "roomEventId") final String roomEventIdStr
) {
return typedCreativeMaterialList(roomEventIdStr, Creative... |
36c3e265-9972-487a-90e9-4cee076eb756 | 2 | @Override
public boolean add(Object item) {
conn = new SQLconnect().getConnection();
if(item instanceof Timenode)
{
Timenode newitem = new Timenode();
newitem = (Timenode)item;
try {
String sql = String.format("INSERT INTO Timenodes(time_weight, time_description, time_owner, display)" +
... |
82ea24f3-fa57-4054-85ba-6aa38dd24d7c | 1 | public void connectToServer() throws IOException{
try {
this.conn.initConnection();
String pingString = this.receiveMessage();
this.send(pingString);
} catch (IOException e) {
throw(e);
}
} |
b0c8b566-6738-4294-89ef-fe98e723fa27 | 7 | private Transaction openRead(Transaction me) {
// not in a transaction
if (me == null) { // restore object if latest writer aborted
if (writer.isAborted()) {
restore();
version++;
writer = Transaction.COMMITTED;
}
return null;
}
// Am I still active?
if (!me... |
b491bcd8-eee7-4b9c-9d63-f769a17934d7 | 2 | public GameRunner(Integer personCount, Integer[] scoreSequence) {
bowlingGame = new Game(personCount);
PinCount pinCount;
for(Integer score : scoreSequence) {
try {
pinCount = new PinCount(score);
bowlingGame.roll(pinCount);
} catch (Exception e) {
e.printStackTrace();
}
}
} |
bed09545-823e-451d-bd8d-6b71bb1494e9 | 5 | public BTPosition<T> lowestCommonAncestor(Position<T> root, T a, T b)
throws InvalidPositionException {
BTPosition<T> BTroot = checkPosition(root);
while (BTroot != null) {
T currentV = BTroot.element();
if (comp.compare(currentV, a) > 1 && comp.compare(currentV, b) > 1) {
BTroot = BTroot.getLeft();
... |
65d9fdb3-c8ca-41ef-acd1-df482d144b35 | 8 | private List<MazeCell> getNNodesNoDiagonal(MazeCell node) {
ArrayList<MazeCell> nbrs = new ArrayList<>();
int x = node.getX();
int y = node.getY();
int xmin = x;
int xmax = x;
int ymin = y;
int ymax = y;
if (x - 1 >= 0) {
xmin = x - 1;
... |
f0470a83-8ca0-4f15-b84d-0272fab190c5 | 1 | public static void main(String[] args) throws IOException, ClassNotFoundException, SQLException {
ClienteDAO teste = new ClienteDAO();
Connection c = ConfigurarDB.ConectarComBanco();
Cliente novo = new Cliente(100, "allan", "rock");
teste.ConectarComBanco(c);
... |
a73b5eef-b5b2-43d8-9973-879d43e27b7a | 6 | public static ListNode rotateRight(ListNode head, int n) {
int len = 1;
if(head == null) {
return null;
}
ListNode cur = head;
while(cur.next != null) {
len++;
cur = cur.next;
}
n = n % len;
if(len == 1 || n == 0) {
return head;
}
Lis... |
1c4c7c7d-fdd6-4846-8116-3593fd805307 | 4 | public void save(DataOutputStream out) throws IOException {
out.writeShort(JPEGImage.DHT);// DHT标志
int len = 16+mPairs.size();
byte[] bytes = new byte[len];
out.writeShort(2 + 1 + len);// 写入段长度
out.write( mType<<4 | mID );// 写入Huffman树类型、ID。
ArrayList< ArrayList<Integer> ... |
80f25745-a62a-4d9c-9ae8-7a428ab577cf | 5 | @Override
public boolean hasNext() {
if (this.doNext == ProcessStages.ProcessParent) {
this.next = this.treeNode;
this.doNext = ProcessStages.ProcessChildCurNode;
return true;
}
if (this.doNext == ProcessStages.ProcessChildCurNode) {
if (chil... |
43470351-0a2e-42b3-9754-3c53bb0016e5 | 5 | private long removeRefContact(long lIndex) {
//
// loop through the elements in the actual container, in order to find the one
// at lIndex. Once it is found, then loop through the reference list and remove
// the corresponding reference for that element.
//
Contact refActualElement = GetContact(lIndex);
if (r... |
03f5d3d7-7d2f-4d3f-a9be-af54ac3aa653 | 9 | public static String getReturnData(String urlString) throws UnsupportedEncodingException {
String res = "";
try {
URL url = new URL(urlString);
//System.out.println(urlString);
java.net.HttpURLConnection conn = (java.net.HttpURLConnection)url.openConnection();
... |
91b980c4-55ca-4bb7-9d03-221d31d9c224 | 3 | public static List<Question> getRandomQuestions(int count, Type type)
{
List<Question> questionList = new ArrayList<Question>(count);
try
{
PreparedStatement getRandomQuestionsStatement = getQuestionsFromDatabaseStrategy.getStatement();
getRandomQuestionsStatement.s... |
e28cc675-ca9f-4426-94d6-243b56b61323 | 1 | private void initGame(GameContainer gc) throws SlickException
{
app.setMouseGrabbed(false);
state = GameState.inGame;
Image img_perso = null;
Image img_fight = null;
Image img_floor = null;
Image img_wall = null;
Image img_light = null;
try
{
img_fight = new Image("images/hit.png");
img_perso... |
33670751-375e-4bd4-9be6-7bb52a1ce9a2 | 2 | @Override
public void Consultar() throws SQLException
{
try
{
Conexion.GetInstancia().Conectar();
ResultSet rs = Conexion.GetInstancia().EjecutarConsulta("SELECT Nombre, Direccion, Cupo FROM cliente WHERE Cedula = '"+cliente.getCedula()+"';");
w... |
def395a6-475a-4ca4-aa6d-98a2d4d73b90 | 7 | @Override
public boolean equals(final Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
MethodStatistics other = (MethodStatistics) obj;
if (currentMethod == null) {
if (other.currentMethod != null)
return false;
} els... |
3ac98b56-cdaa-4f43-b308-e6942e49ebb5 | 5 | @Override
public boolean canMove(Board board, Field currentField, Field emptyField) {
if (this.validSetupForMove(currentField, emptyField) && emptyField.inSameFileAs(currentField)) {
if (emptyField.distanceBetweenRank(currentField) == this.forwardDistance(1)) {
return true;
} else if (this.isFirstMove() &&... |
ed64bbfd-e664-47a1-bc4c-b8de193329a5 | 1 | private void abandonAndBuildNewNest(double pa, int N) {
if (Math.random() <= pa)
nests.set(nests.size() - 1, new Nest(new Egg(N)));
} |
38d7a3d3-228f-47d7-8622-ceb0095276e7 | 2 | public double[] standardizedItemMaxima(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.variancesCalculated)this.meansAndVariances();
return this.standardizedItemMaxima;
} |
eaf9986e-4289-47b4-b249-66b23a0424f1 | 4 | public static Tile shortToTile(short i, Level l, int x, int y) {
Tile tile = new FloorTile();
try {
Class<? extends Tile> class1 = shortToTileMap.get(i);
if (class1 == UnbreakableRailTile.class) {
tile = (Tile) class1.getConstructor(new Class[] { Tile.class })
.newInstance(new Object[] { new FloorTi... |
92ee36aa-5fd9-4df2-af9f-8538ff2238ee | 2 | @Override
public void handleEmptyEventQueue() {
// TODO Auto-generated method stub
super.handleEmptyEventQueue();
if (exec1xTraffic) {
TrafficExportImport.changeReabilityModel();
TrafficExportImport.readEvents("./Traffic/" + id_execution + "_traffic_"+ Tools.getNodeList().size() + ".txt");
//Tr... |
a506b950-b742-46f3-9e25-a0e118073a37 | 1 | private String loginUser(String name, String cmd,String pass) throws InterruptedException, IOException {
readUntil(GosLink.prps("puser"));
write(name);
readUntil(GosLink.prps("ppass"));
write(pass+"\r\n");
readUntil(GosLink.prps("pmenu"));
if (ghost == 1){
write("=x\n");
ghost=0;
return "reload";
... |
da97c94a-062d-4719-b31e-f55b0599b40f | 0 | public String next() {
long between = end.getTime() - start.getTime();
Date result = new Date(start.getTime() + (long) Math.floor(Math.random() * between));
return String.format("'%s'", sdf.format(result));
} |
1b1b91c8-c7e7-49f3-abcb-ba64a60d090e | 8 | private boolean r_postlude() {
int among_var;
int v_1;
// repeat, line 75
replab0:
while (true) {
v_1 = cursor;
lab1:
do {
// (, line 75
// [, line 77
bra = cursor;
// substring, l... |
347a4b2c-614e-4932-aa13-0259494c6830 | 8 | private static void hideEmptySuper(ClassWrapper wrapper) {
for (MethodWrapper method : wrapper.getMethods()) {
if (CodeConstants.INIT_NAME.equals(method.methodStruct.getName()) && method.root != null) {
Statement firstData = Statements.findFirstData(method.root);
if (firstData == null || first... |
daf52520-837d-46ac-8b52-cfb36f4e7a52 | 9 | private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
int res=JOptionPane.showConfirmDialog(this,"Do you want to save this before quiting ?","New",JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.QUESTION_MESSAGE);
if(res==JOptionPane.NO_OPTION){
JFil... |
2f4d9025-07b6-49e9-be48-67c202096e9b | 8 | private boolean readFeed() {
try {
// Set header values intial to the empty string
String title = "";
String link = "";
// First create a new XMLInputFactory
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
// Setup a new eventReader
InputStream in = read();
if (in != null) {
... |
1f5faf09-1bce-491d-8616-ef549d8a0903 | 9 | public void panelWelcome() throws IOException {
GridBagConstraints layoutConstraints = new GridBagConstraints();
JLabel icon = new JLabel(getImage("resources/icon.png", 200));
JLabel title = new JLabel("Welcome to JImageViewer!");
title.setFont(new Font("Droid Sans", Font.BOLD, 54));
title.setH... |
3293b8a1-6348-4168-a205-977df0b0b028 | 3 | public void filledCircle(double x, double y, double r) {
if (r < 0) throw new RuntimeException("circle radius can't be negative");
double xs = scaleX(x);
double ys = scaleY(y);
double ws = factorX(2*r);
double hs = factorY(2*r);
if (ws <= 1 && hs <= 1) pixel(x, y);
... |
c64a864b-e474-4464-9da2-ba5a484a75c6 | 1 | public void visitEnum(final String name, final String desc,
final String value) {
++size;
if (named) {
bv.putShort(cw.newUTF8(name));
}
bv.put12('e', cw.newUTF8(desc)).putShort(cw.newUTF8(value));
} |
4d9b0a9d-b6cb-4d36-b4f2-44b6dfa3a0f1 | 0 | public UpdateRunnable(LogOre plugin, Choice choice, int id, String file) {
super(plugin, choice, id, file);
this.result = Result.NO_UPDATE;
this.VERSION_URL = "https://api.curseforge.com/servermods/files?projectIds=" + id;
} |
657134e6-2ff5-4cf4-8c1f-95f73ba31f9d | 7 | private boolean isStable(Board board, Location move, int identifier) {
// create copy of board to sim
// this.simBoard = Board.copy(board);
int oppID = (identifier % 2) + 1;
Location attempt;
// this.simBoard.getTile(move.getHorizontal(),
// move.getVertical()).setColor(identifier);
for (int i = 0; i < ... |
29329148-9bd9-4329-85f4-3e8ccbbeaf80 | 9 | private static void extractSearch(String commandInfo) {
if(commandInfo == null || commandInfo.equals("")) {
dataPacket[LOCATION_COMMAND_ID] = ERROR_WRONG_PARAM;
} else if(TimeParser.checkDate(commandInfo)) {
try {
String searchDate = TimeParser.getDate(commandInfo);
dataPacket[LOCATION_COMMAND_ID] = I... |
ecd9b21d-9e05-47c9-860f-75497e353cff | 3 | public int getSelectedIndex() {
if (type != MULTIPLE) {
/*
if (type == IMPLICIT) {
for (int i = 0; i < size(); i++)
if (getLabel(i).hasFocus()){
setSelectedIndex(i, true);
return i;
}
}*/
for (int i = 0; i < size(); i++)
if (isSelected(i))
... |
5e7a17c4-195b-4901-b343-06ab5fccb566 | 3 | public List<River> getAllRivers (boolean getAll) {
if (getAll)
return rivers;
List <River> filteredRivers;
filteredRivers = new ArrayList<River>();
for (River r: rivers) {
if (r.getIsFavoured()) {
filteredRivers.add(r);
}
}
return filteredRivers;
} |
73607c36-78d9-4689-8499-6e346b6ce65d | 2 | public CounterParties(Accounting accounting){
addSearchKey(ACCOUNTNUMBER);
setName(COUNTERPARTIES);
try {
accounting.addBusinessObject(this);
} catch (EmptyNameException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Temp... |
bd6a1696-bf3d-4b27-b370-39d3b54a2b7b | 0 | public void setTopLeft(int x, int y)
{
topLeft[0] = x;
topLeft[1] = y;
} |
9f40cbdb-4791-4daa-b67e-380532ae8b03 | 4 | public FlashShot(String getColour,boolean fade)
{
style = fade;
if (fade)
{
transparency = 255;
}
if (getColour.equals("Black"))
{
flashScreen.setColor(Color.BLACK);
}
else if (getColour.equals("White"))
{
fl... |
099eeefc-ff0b-4291-9481-8ea912fd0dd4 | 2 | private void doDrawing(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
BufferedImage img = null;
img = createImage();
/* try {
img = ImageIO.read(new File("image.jpg"));
} catch (IOException e) {
}*/
img.flush();
... |
6aec18cd-4487-42a9-8376-8eab2ada5fa1 | 5 | private void validarLogin(){
FuncionarioController fc = new FuncionarioController();
String senha = txSenha.getText();
String login = txLogin.getText();
boolean retorno = fc.autenticarLogin(login, senha);
if(retorno == true){
... |
c0cdc90a-d97a-437b-ab12-419c436e477e | 4 | @Override
public String convertToString(Character[] array) {
if (array.length == 0) {
return "";
}
StringBuilder buf = new StringBuilder(array.length * 8);
for (int i = 0; i < array.length; i++) {
if (arr... |
8d53afe4-4ffd-455e-a75f-8769ea2a6b3f | 2 | public int searchIndexGraphNode(GraphNode nodo){//searches the position of the node in the list.
for(int i=0;i<graph_nodes.getLength();i++){
if(nodo.equals(graph_nodes.get(i)))
return i;
}
return -1;
} |
a5f14922-5e4f-4ea3-ad85-6ffef455b13b | 3 | private int setStartedAllready(int x) {
Boolean mediaStarted = false;
mediaStarted = mediaPlayer.isPlaying();
if(mediaStarted) {
startedAllreadyGlobal = true;
theTimer.stop();
}
x = x + 200;
if(x > 5000 && mediaStarted == false){
Syst... |
70b2af4e-99e9-4027-a10e-ef90f604c729 | 7 | public void merge(int[]a, int begin, int end){
if(begin >= end)return;
int center = (begin + end)/2;
merge(a, begin, center);
merge(a, center + 1, end);
int lbegin = begin;
int rbegin = center + 1;
int[] temp = new int[a.length];
int i = begin;
while(lbegin <= center && rbegin <= end){
if(a[lbegin]... |
479f823d-2f30-42bb-84fc-b46e4800e767 | 7 | @Override
public ContainerRequest filter(ContainerRequest containerRequest)
throws WebApplicationException {
// GET, POST, PUT, DELETE, ...
String method = containerRequest.getMethod();
// /tasks for example
String path = containerRequest.getPath(true);
System.out.println(path);
// We allow login lo... |
9fa8f1d5-384b-4479-938e-c8d8aa04b793 | 3 | private static int arrayHashCode(Object object)
{
if (object == null)
return 0;
int result = 1;
Object[] array = (Object[]) object;
for (int i = 0; i < array.length; ++i) {
int elementHashCode = 0;
if (array[i] != null)
elementHashCo... |
8c585487-dcf5-4fb1-b8df-c89d1aeeaf08 | 5 | public static Double calcDateValue( String dateString )
{
String[] formats = {
"MM/dd/yyyy HH:mm:ss",
"MM/dd/yy HH:mm:ss",
"MM/dd/yy",
"MM/dd/yyyy",
"MM/d/yyyy HH:mm:ss",
"MM/d/yy HH:mm:ss",
"yy-M-d hh:mm:ss a",
"yy-M-d HH:mm:ss",
"yy-M-d hh:mm a",
"yy-M-d HH:mm",
"dd-M-yy... |
b6c79982-c373-433f-a527-f76e43dbd491 | 1 | public void testFactory_fromDateFields_null() throws Exception {
try {
LocalDateTime.fromDateFields((Date) null);
fail();
} catch (IllegalArgumentException ex) {}
} |
6f142762-ed31-4f2f-9864-15b94748919b | 3 | @Override
public boolean equals(Object obj)
{
if (this == obj)
{
return true;
}
if (obj == null || this.getClass() != obj.getClass())
{
return false;
}
Project other = (Project) obj;
/*
* Omit expandType to allow manually-assembled projects to still equal
* auto-expanded ones, if all els... |
ebf87de9-7671-4144-822e-72927f82db87 | 2 | public void applyPermissions() {
if (this.group.equals(GroupType.MANAGER)) {
permissions.put("Dashboard", true);
permissions.put("Products", true);
permissions.put("Statistics", true);
permissions.put("Create Trays", true);
permissions.put("Logout", true);
permissions.put("Create Stock", true);
p... |
4b61325b-a4a1-4be8-b0e9-c9145f36008f | 2 | public void paintBorder(Component component, Graphics g, int x, int y, int w, int h) {
g.setColor(Color.black);
g.drawRect(x + dist / 2, y + dist / 2, w - dist, h - dist);
if (component.hasFocus()) {
for (int i = 0; i < locations.length; i++) {
Rectangle rect = getRectangle(x, y, w, h, locations[i]);
... |
70d9e7d4-b26c-46a7-9dca-26f443987335 | 3 | private void RodLogic(MouseEvent e){
if(e.getButton() == 1){
Point t1 = getMouseLocationOnComp();
AttachmentPoint tPoint = GetAttachmentPoint(t1);
if(tPoint == null){
double[] t2 = {t1.getX(), t1.getY()};
tPoint = new AttachmentPoint(.5, t2);
attachPoints.add(tPoint);
... |
3f4dd6f0-61a0-4ec7-b3d2-3da3acb8ce89 | 7 | private int fixOrphans()
{
//For each orphanned label reference...
for(Label o : m_orphans)
{
boolean bFound = false; // was this orphan's label found?
if (m_verbose)
System.out.print("Searching for orphan label: " + o.name + " among: ");
... |
76c518d7-4a20-46ed-a52a-a4fe5e1495c6 | 5 | protected boolean isConflictRules(Rule r1, Rule r2) throws TheoryNormalizerException {
logMessage(Level.FINER, 1, "verify conflict rules", r1.getLabel(), r2.getLabel());
boolean isConflictRule = false;
List<Literal> r1Heads = r1.getHeadLiterals();
List<Literal> r2Heads = r2.getHeadLiterals();
for (int j = 0; ... |
654b6f5a-4ea6-4df2-a9a5-4c31f0f0c1db | 3 | public boolean isBattleWon() {
if (enemy[0].isAlive() == false && enemy[1].isAlive() == false
&& enemy[2].isAlive() == false) {
return true;
}
else {
return false;
}
} |
3d56056c-cba2-4994-a4b8-eba6e0be66e0 | 5 | public String createPopulation(ArrayList<String[]> ped) {
individual = new ArrayList<Individual>();
founderAlleleCount=0;
int iCount = ped.size();
for (int i=0; i<iCount; i++) {
//System.out.println(i+": "+ped.get(i)[0]+" "+ped.get(i)[1]+" "+ped.get(i)[2]);
if (pe... |
8d9129bd-4cf4-4503-8b4a-2b014321e754 | 0 | public String[] splitToWords(String text)
{
String[] result = null;
text = text.replaceAll("\n", "\n ");
result = text.split("[ \t\f\r]");
return result;
} |
ccccb58d-ce22-4d1c-8f20-23bb21604679 | 9 | void SetInfo(String info) {
StringBuffer user, desc, conn, mail, share;
int index = 0;
user = new StringBuffer();
while (info.charAt(index) != ' ') {
user.append(info.charAt(index));
index++;
}
String strUser = user.toString();
if (strUser.equalsIgnoreCase(_bot.botname()))
return;
index++;
d... |
a2eb84dd-53ef-4571-aa87-c9126efa6807 | 3 | public Collection<WordOccurences> getAllTerms() {
try {
List<String> terms = myStem.lemmatize(path);
Map<String, WordOccurences> occurences = new HashMap<>();
for (int i = 0; i < terms.size(); ++i) {
String term = terms.get(i);
if (occurences.c... |
ae2a500b-15b6-4126-ac2e-a63b7f3e19c2 | 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 Townshippolicestation)) {
return false;
}
Townshippolicestation other = (Townshippolicestation) object;
if ((th... |
2faf8c44-7a76-4422-b647-6cbd955fd83b | 8 | public static byte[] getCommand(String command, startGui GUI, int Tabid) {
byte[] returnArr = null;
String commands[] = command.split(" ", 2);
if (commands[0].equalsIgnoreCase("§nick")) {
if (commands.length > 1) {
returnArr = Message.changeNick(commands[1]);
... |
d5e39e50-0dfa-4155-8cef-5b7bc3bdf296 | 2 | protected Cellule laplusproche(List<Cellule> ressource){
Cellule cel = ressource.get(0);
int plusproche = ressource.get(0).coord.distance(this.curent.coord);
for (int i =1 ; i<ressource.size() ; i++){
if(ressource.get(i).coord.distance(this.curent.coord)< plusproche){
cel = ressource.get(i);
plusproche... |
5d337c40-0f0a-4401-8ca8-c37de7aeaabc | 7 | private static void findLinks(URL url, Integer counter) {
/*
* now we construct the first html body
*/
HtmlBody htmlBody;
/*
* now we actually create the html body
*/
try {
/*
* we have to create a new http client for every request because
* the sockets are use once-only
... |
7a3d89b6-c961-4911-8949-be398779f5cb | 1 | public static boolean belongsInProductionWithUsefulVariableSet(
Production production, Set usefulVariableSet) {
if (isValidProduction(production, usefulVariableSet)) {
return true;
}
return false;
} |
33c4e4f4-a716-45c1-9ea3-3341d6c94d99 | 2 | public LvlReader(String str){
Properties prop= new Properties();
String str2 = "/res/"+str;
try{
InputStream in = getClass().getResourceAsStream(str2);
prop.load(in);
Level.xMax =Integer.parseInt(prop.getProperty("xMax"));
Level.widthMu =Integer.parseInt(prop.getProperty("widthMu"));
Level.dxMu =In... |
ff603b14-c269-4514-8beb-efdfe794c908 | 7 | @Override
public void run() {
int varA = 1;
detenethilo = false;
while (true) {
if (detenethilo) {
break;
}
int x = Juego.jFlappy.getLocation().x;
if (!isSaltar()) {
int y = Juego.jFlappy.getLocation().y;
... |
36a8e321-3ca2-4f0c-9131-5511ffeb06db | 8 | public String updateUsuario() {
boolean transaccionCorrecta = false;
try {
rolUsu = rolUsu.charAt(0) == '1' ? "ADMINISTRADOR" : rolUsu;
rolUsu = rolUsu.charAt(0) == '2' ? "SECRETARIA" : rolUsu;
rolUsu = rolUsu.charAt(0) == '3' ? "CHOFER" : rolUsu;
... |
b616ff32-1ae6-4384-a9fb-dcb9129279cc | 1 | public static void printlnWithColor(String color, String message){
try{
Colores col = Colores.valueOf(color.toUpperCase());
System.out.println("\033[" + col.cod + "m" + message + "\033[30m");
}catch (IllegalArgumentException e){
System.out.println("\033\tError: " + e.... |
dc8180fa-0af8-4a5b-8c52-e5c2a0c25a3c | 1 | public Map create(String name, Tile[][] map) throws MapNotRectangularException, MapAlreadyExistsException{
if(!mapMap.containsKey(name)){
return new Map(name, map);
}
else {
throw new MapAlreadyExistsException();
}
} |
a1923ba0-6d8d-4298-b1ff-df675944a720 | 4 | public int getInt() throws IOException {
String s = "";
while ( (c != '\n') && Character.isSpaceChar(c) )
getChar();
while ( (c != '\n') && !Character.isSpaceChar(c) ) {
s = s + c;
getChar();
}
return Integer.parseInt(s);
} |
588efd8d-d855-4819-9d79-755e30560e4e | 9 | private void setImgCoords() {
switch(type) {
case DIG:
imgX1 = 2*BLOCKSIZE + (depth/4)*BLOCKSIZE;
imgY1 = (depth % 4) * BLOCKSIZE;
break;
case DIRT:
imgX1 = 0;
imgY1 = 0;
break;
ca... |
69f0545d-5268-4387-8036-ecbc606dfd3b | 0 | @Override
public int getPreferenceListSize() {
return prefs.size();
} |
7b6ac8c0-8a0a-4cda-b2d2-889640b69583 | 8 | public JStackMeta process() {
try {
FileInputStream inputStream;
inputStream = new FileInputStream(_file);
BufferedReader in = new BufferedReader(new InputStreamReader(inputStream));
boolean finishedHeader = false;
JStackEntry currentEntry = new JSta... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.