method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
a01c305d-8611-4b50-ab7b-20ced65fb051 | 9 | @Override
public void removeAt(int index) {
if(head == null){
throw new IndexOutOfBoundsException();
} else if(!checkIndex(index)){
throw new IndexOutOfBoundsException();
} else {
Node<T> temp = head;
for (int i = 0; i < index; i++) {
... |
c0364f7c-c955-4482-8469-3ff47ea5c26d | 6 | public Entity collide(float x, float y, String type) {
for (Entity e : DOServer.entities)
if (e.type.equals(type)
&& x < e.x + e.width
&& y < e.y + e.height
&& x + width > e.x
&& y + height > e.y)
return e;
return null;
} |
56cb119a-7ec2-4a36-be21-a17706cea6f0 | 3 | public static int numberOfInversions(List<Element> a) {
int counter = 0;
for (int i = 0; i < a.size() - 1; i++) {
for (int j = i + 1; j < a.size(); j++) {
if (a.get(i).getValue() > a.get(j).getValue()) {
counter++;
}
}
... |
803005f0-fe43-43bb-97bb-983867edf2fd | 4 | public TrieNode search(String word){
TrieNode location = root;
int char_code;
for(int i = 0; location != null && i < word.length(); i++) {
char_code = word.charAt(i) - 'a';
location = location.getBranch(char_code);
}
if(location != null && location.getF... |
17bc1f7b-4f24-42ee-843d-c6b7e082993e | 2 | public void run() {
sleep();
while (!isInterrupted()) {
prepareNextRound();
if (!isGameOver()) {
playNextRound();
} else {
break;
}
sleep();
}
} |
9b3b5810-00f2-4993-93d4-ad3e7e15c73e | 5 | @Override
protected void paintComponent(Graphics arg0) {
if (plantType == GREEN_PLANT) {
arg0.setColor(Color.GREEN);
} else if (plantType == RED_PLANT) {
arg0.setColor(Color.RED);
} else if (plantType == YELLOW_PLANT) {
arg0.setColor(Color.YELLOW);
} else if (plantType == MAGENTA_PLANT) {
ar... |
f5b776be-bc00-4177-98a0-9638d51fecaf | 1 | private void doBeforeProcessing(ServletRequest request, ServletResponse response)
throws IOException, ServletException {
if (debug) {
log("filtroAutenticacion:DoBeforeProcessing");
}
// Write code here to process the request and/or response before
// the rest of ... |
e7502c00-b26b-4846-9674-d9a45b03dfe7 | 8 | void releaseConnection() throws SQLException {
if (conn == null) {
log.debug("not connected");
return;
}
try {
if (connector != null && connector.usesAutoRollback()) {
try {
conn.rollback();
outputMessage... |
c03c78e9-3031-4d9a-a86c-6ad9b639461f | 6 | @Override
public Object getValueAt(int rowIndex, int columnIndex) {
ProduktDTOView produkt = produktList.get(rowIndex);
Object value = null;
switch (columnIndex) {
case 0:
value = produkt.getProduktId();
break;
case 1:
value = produkt.getProduktNavn();
break;
case 2:
value = produkt.getFareN... |
32a041bb-6e5d-46ad-8abd-792f10d23f53 | 5 | public void doAction(Player player) throws InvalidActionException {
if (player == null)
throw new IllegalArgumentException("Player can't be null!");
if (player.getRemainingActions() <= 0)
throw new InvalidActionException("The player has no turns left!");
Position pos = player.getPosition();
if (play... |
fa7a0e37-e2d0-4537-8207-61f7b3004a32 | 2 | public static Product getById(final String token, final String id) {
JSONArray fetchById = null;
try {
fetchById = fetchById(token, "products", id);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
List<Product> formatOutputs = formatOutputs(fetchById);
if (format... |
db92f7c8-1483-4bb7-9e5a-e70dd5862b02 | 8 | public void setCam(int xCam, int yCam)
{
xCam /= distance;
yCam /= distance;
int xCamD = this.xCam - xCam;
int yCamD = this.yCam - yCam;
this.xCam = xCam;
this.yCam = yCam;
g.setComposite(AlphaComposite.Src);
g.copyArea(0, 0, width, height, xCamD, yCa... |
330e03d4-b755-4ae5-ad6d-0900cd4ba00f | 5 | private void jButtonPaysValiderMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButtonPaysValiderMousePressed
if (this.jButtonPaysValider.getText().equals("Valider")) {
try {
RequetesPays.insertPays(jTextFieldPays.getText().toUpperCase());
} catch ... |
d7078346-1937-4c6d-b009-e38363b2e3d2 | 3 | public boolean setInterArrivalTimeParameters(int jobType,
double aarr, double barr, double anum, double bnum, double arar) {
if(jobType > BATCH_JOBS || jobType < INTERACTIVE_JOBS) {
return false;
}
if(useJobType_) {
this.aarr[jobType] = aarr * arar;
this.barr[jobType] = b... |
c9a3a12f-d385-4dfd-9698-5a099991d951 | 4 | public boolean processCommand(Terminal terminal, List<String> words) {
boolean leave = false;
if (!words.isEmpty()) {
switch (words.get(0)) {
case "borrow":
terminal.borrow();
break;
case "help":
terminal.help();
... |
00b2c5ad-53a0-44e8-b8c6-4a70c07bda47 | 3 | private boolean isStraight(){
int cnt=0;
for (int i = 0; i < crds.size()-1; i++) {
if(crds.get(i).getRankID()<crds.get(i+1).getRankID()){
cnt++;
if(cnt==4){
System.out.println("straigth matched*********************************");
return true;
}
}
}
return false;
} |
adc223d4-de59-4547-8e20-418d2f13a975 | 0 | public String getErrorMessage() {
return errorMessage;
} |
e0662193-2cd5-4f9c-b5f4-1bed4971c66a | 2 | public ArrayList<InstituicaoSubmissao> listar(String condicao) throws Exception
{
String sql = "SELECT * FROM instituicaosubmissao " + condicao;
ArrayList<InstituicaoSubmissao> listaInstSubmissao = new ArrayList<InstituicaoSubmissao>();
try
{
PreparedStatement stmt = ConnectionFactory.getConnection().pre... |
808e2749-94e2-4eb0-a963-fa2bb4700fc2 | 3 | public void insurance() {
double pBank = playerBank;
double pBet = playerBet;
if ((pBank -= (0.5) * pBet) >= 0) {
System.out.println("Dealer's Visible Card is an Ace. "
+ "Would you like to purchase Insurance? " + "(y/n): ");
String playerAction = stringInput.nextLine();
playerAction.toLowerCase();... |
302f8d96-d4c3-4a0d-843f-1827c5354b25 | 2 | public Card getCard(int position) {
if (position < 0 || position >= hand.size())
throw new IllegalArgumentException("Position does not exist in hand: "
+ position);
return (Card)hand.get(position);
} |
c0164f87-fcf0-49db-80b3-cb44af456fd6 | 2 | public static List<Interlocuteur> selectInterlocuteur() throws SQLException {
String query = null;
List<Interlocuteur> interlocuteur1 = new ArrayList<Interlocuteur>();
ResultSet resultat;
try {
query = "SELECT * from INTERLOCUTEUR order by INTNOM ";
PreparedStat... |
8d823a13-5d75-4a5f-8afe-67b396eb3a31 | 3 | public void updateCharClass()
{
int currentClass = characterClass.id;
switch (currentClass)
{
case 0:
charClass = PlayerClass.FIGHTER;
break;
case 1:
charClass = PlayerClass.THIEF;
break;
case 2:
charClass = PlayerClass.MAGE;
break;
}
skill0 = charClass.primarySkill;
skill1 = ch... |
1c52341b-42ba-4e5e-a123-5c5204b1fa7c | 9 | public void dumpQueue(Connection conn, PrintWriter writer)
throws ServerException {
logger.info("Preparing queue for processing...");
Statement stmt = null;
ResultSet results = null;
int resultCount = 0;
try {
stmt = conn.createStatement();
res... |
e83f5320-fa58-43b9-96f7-63d15f05b093 | 4 | private static GUIOptions parseOptions(String[] args) {
GUIOptions options = new GUIOptions();
for (int i = 0; i < args.length; i++) {
String arg = args[i];
if ("-window".equals(arg)) {
options.disableFullScreen = true;
} else if ("-seed".equals(arg)) {
long randomSeed = Long.parseLong(args[++i]);... |
86a31417-a3c7-40bd-946f-6b252529467d | 3 | @Override
public void deserialize(Buffer buf) {
uid = buf.readInt();
if (uid < 0)
throw new RuntimeException("Forbidden value on uid = " + uid + ", it doesn't respect the following condition : uid < 0");
qty = buf.readInt();
if (qty < 0)
throw new RuntimeExcep... |
3189a191-227a-4779-aae9-19c956a259f5 | 3 | private void btnLoginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLoginActionPerformed
StartForm startForm1 = new StartForm();
System.out.println("Username "+UserName);
System.out.println("Password "+password);
loginPage lPage=new loginPage();
try {
... |
2704fb59-1d19-493a-8f65-2ec81a66ca62 | 8 | public static Stella_Object accessWhynotProofClassSlotValue(WhynotProofClass self, Symbol slotname, Stella_Object value, boolean setvalueP) {
if (slotname == Logic.SYM_LOGIC_REPRESENTATIVE) {
if (setvalueP) {
self.representative = ((Justification)(value));
}
else {
value = self.rep... |
e914e448-6f40-40b8-9cd3-5b8543d4e15d | 7 | public boolean changeGroup(String groupid, String nameid){
if (!plugin.query.isConnected()){
log.log(Level.INFO, "changeGroup(): Not connected to TS3 server!");
return false;
}
HashMap<String, String> hmIn;
try{
String command = "servergroupaddclient";
if (groupid != null && groupid.length() >... |
03088f6b-3e52-41c0-9de3-615fdfb15478 | 4 | public PreparedStatement getStatement(String query) {
PreparedStatement statement = null;
try {
if(getConnection().isClosed() || (getConnection() == null)) {
connect();
}
statement = getConnection().prepareStatement(query);
return statement;
} catch(Exception e) {
e.printStackTrace();
try {
... |
ecddf41c-6125-432b-b663-a8ec3a10022a | 3 | public void fireWaitingEvents() {
synchronized (waitingEventLists) {
for (Entry<MouseEventType, Collection<IMouseEventable>> kvp : waitingEventLists.entrySet()) {
for (IMouseEventable eventableObject : kvp.getValue()) {
kvp.getKey().fireEvent(eventableObject);
}
}
// Clear all of the waiting ev... |
e6c9b3e9-7e3c-4b7b-9374-3bd4cb7306a1 | 7 | public synchronized void holdTeamLeadManagerMeeting(Manager mgr){
mgr.inMeeting = true;
for(int ls = 0; ls < mgr.teamLeads.size(); ls++)
{
mgr.teamLeads.get(ls).inMeeting = true;
}
while(!mgr.areLeadsAllHere())
{
try{
mgr.sleep(5);
... |
cbeaad3b-1cb8-4b27-bedf-47580a88564d | 1 | protected void addLinhaVenda2(LinhaVenda lv) throws ExceptionGerenteVendas{
if(linhas.contains(lv)){
throw new ExceptionGerenteVendas("Linha de Venda j� foi inserida nesta venda");
}else{
linhas.add(lv);
lv.setVenda(this);
}
} |
ae254f51-9630-444a-90ce-49a357a0c01c | 9 | static final public TsurgeonPattern Root() throws ParseException {
/*@bgen(jjtree) Root */
SimpleNode jjtn000 = new SimpleNode(JJTROOT);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);TsurgeonPattern result;
try {
result = Operation();
jj_consume_token(24);
jjtree.closeNodeScope(jjtn00... |
82b19b6e-a22a-4cdb-aa90-5b1a481d0f1a | 8 | public void update(){
if(!won && !dead){
if(hasStarted){
elapsedMS = (System.nanoTime() - startTime)/1000000;
formattedTime = formatTime(elapsedMS);
}
else{
startTime = System.nanoTime();
}
}
checkKeys();
if(score >= highScore){
highScore = score;
}
for (int row = 0; r... |
3b3c487c-485f-4ca5-aaf7-648c2e0a83a4 | 9 | public String execute() throws Exception {
setMenuActive("5");
Map<String, Object> constraints = new HashMap<String, Object>();
constraints.put(ProductPriceService.PAGE_SIZE, getPageSize());
if (inventory!=null) {
if (page!=null) {
int pageResult = page.getPageResult();
int ctrTotal = 0;
if (S... |
ddba4f2d-9ef9-4299-a663-4326c7e12a7f | 3 | public static void checkDatParam(SessionRequestContent request, Criteria criteria, String reqName, String critName){
String param = (String) request.getParameter(reqName);
if (param != null && !param.isEmpty()) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
t... |
205402f4-38e9-4d8c-aa00-c9fd05e35788 | 7 | @Override
public int castingQuality(MOB mob, Physical target)
{
if(mob!=null)
{
if(mob.isInCombat())
return Ability.QUALITY_INDIFFERENT;
if(CMLib.flags().isSitting(mob))
return Ability.QUALITY_INDIFFERENT;
if(!CMLib.flags().isAliveAwakeMobileUnbound(mob,false))
return Ability.QUALITY_INDIFFER... |
4d104129-f579-4c49-a774-ce36bf2b9f2e | 2 | public int[] getTile(int x, int y)
{
int shift = 0;
if(showCoords)
shift = 1;
int tileXSize = width/(sea.length+shift), tileYSize = height/(sea[0].length+shift);
int x1 = (int)(1.0*(x-this.x)/tileXSize);
int y1 = (int)(1.0*(y-this.y)/tileYSize);
if(showCoords)
{
x1 -= 1;
y1 -= 1;
}
... |
29cf0330-6932-4fc9-a9ab-67b83fa6f6a5 | 3 | public byte[] readStream(InputStream in) throws IOException {
if (in == null) return null;
try {
byte[] data = new byte[16384];
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int len;
while ((len = in.read(data)) != -1) {
baos.wr... |
f507293d-9e6b-4b43-81c3-5657a7ce9afc | 2 | public void init(String templateBaseLocation){
// 初始化FreeMarker配置
// 创建一个Configuration实例
cfg = new Configuration();
cfg.setDefaultEncoding(Config.getEncoding());
log.debug("encoding:" + Config.getEncoding());
log.debug("locale:"+Config.getLocale());
cfg.setEncodin... |
64a24b5b-6082-43ef-a406-db5fef13dc45 | 0 | public void run(){
data = createArray(type);
// if(data != null){
/*ArraysDataBase str = Main.transferArraysDataFromFrameGeneralWindow();*/
ArraysDataBase str = Main.getStructureBase();
str.addData(data);
// }else{
// throw new UnsupportedOperationExcepti... |
8b4b597f-e85c-4fa6-be6b-0cd2f4b4e220 | 6 | public void update(){
age++;
loc.x += dir.x;
loc.y += dir.y;
if(phase == 0 && age > 80){
phase = 1;
}
switch(phase){
case 0: break;
case 1: phase1(); break;
case 2: phase2(); break;
case 3: phase3(); break;
default: break;
}
} |
c8f5f4b4-20bc-47d9-83be-bee093ced09c | 1 | public static void getTail(){
rover = head;
while(rover.next != null){
rover = rover.next;
}
tail = rover;
} |
aaf387d2-7b0a-48da-8041-de50e9ad615e | 2 | public Audio getAudio(String name){
for(Audio au : this.audio){
if(name.equals(au.getName())){
return au;
}
}
Debug.error("Audio does not exist '" + name + "'");
return null;
} |
22e881e6-f31e-468d-929d-8fe54af82d34 | 4 | public ArrayList<ArrayList<String>> partitionHelper(int end) {
ArrayList<ArrayList<String>> result = new ArrayList<ArrayList<String>>();
if (end == 0) {
result.add(new ArrayList<String>());
return result;
}
for (int i = 0; i < end; i++) {
if (isPal[i][... |
db8882db-1961-46c2-b44f-5c2798ba54af | 1 | public void treeSubstitute(Object oldObject, Object newObject) {
List<ArgPosition> locs = getArgPositionsForTerm(oldObject);
for (ArgPosition loc : locs) {
setSpecifiedObject(loc, newObject);
}
} |
34217103-05e0-4e3a-a0b2-00f921c22d1f | 7 | private void readMarkupDecl() throws ParseException, IOException {
if (isPi())
readPi();
else if (isComment())
readComment();
else if (isEntityDecl())
readEntityDecl();
else if (isSymbol(MARKUPDECL_BEGIN)) { // (element-|Attlist-|Entity-|Notation-)Decl
while (!isChar('>')) {
... |
2d981dc9-8e32-4e1b-9571-bc8446321fb9 | 4 | public static void main(String[] args) {
try {
System.out.println("Welcome to jGlacier " + AppCache.appVersion);
String credentialsFile = System.getProperty("user.dir") + "/credentials.json";
try {
Ap... |
733c2201-8680-427b-8ad4-cb63d04ac6fa | 6 | private byte fromOpcode( Opcode opcode ) {
if( opcode == Opcode.CONTINUOUS )
return 0;
else if( opcode == Opcode.TEXT )
return 1;
else if( opcode == Opcode.BINARY )
return 2;
else if( opcode == Opcode.CLOSING )
return 8;
else if( opcode == Opcode.PING )
return 9;
else if( opcode == Opcode.PON... |
10d63e89-df2b-4f56-8aac-c6e26e0f78e7 | 5 | public SpriteEntry getSpriteEntryFromCoords(int areaX, int areaY,
int x, int y) {
int[] wh;
NPC npc;
for (SpriteEntry e : spriteAreas[areaY][areaX]) {
npc = npcs[e.npcID];
wh = spriteGroupDims[npc.sprite];
if ((e.x >= x - wh[0] / 2) && (e.x <= x + wh[0] / 2)
&& (e.y >= y - wh[1] / 2) && (... |
22de39e8-7c69-47c8-ad93-c796c42e6210 | 8 | protected boolean fill() throws IOException {
// check if we already have readable data
if (head != tail)
return true;
// shift extra unread data to beginning of buffer
if (tail > 0 && extra > 0)
System.arraycopy(buf, tail, buf, 0, extra);
... |
586290f5-9067-469e-87c1-4ed7a38c8152 | 2 | @Override
Integer deleteEntity(Criteria criteria, AbstractDao dao) throws DaoException {
criteria.addParam(DAO_CITY_STATUS, DELETED);
Integer res = updateCity(criteria, dao);
List<City> list = getEntity(criteria, dao);
for (City c : list) {
List<Hotel> hotels = (List<Hote... |
8b6bb7cc-13e6-4352-97f2-e54e7fb21103 | 8 | @Override
public void update(Observable o, Object arg) {
if(presenter.getClientModel().getServerModel().getPlayers().get(presenter.getPlayerInfo().getIndex()).getColor()!=null){
getView().setLocalPlayerColor(CatanColor.valueOf(presenter.getClientModel().getServerModel().getPlayers().get(presenter.getPlayerInfo... |
ae0ef885-d712-40d9-ba74-2b64d05e9f23 | 5 | @BeforeClass
public static void setUpBeforeClass() {
try { new MySQLConnection(); }
catch (InstantiationException e) { e.printStackTrace(); }
catch (IllegalAccessException e) { e.printStackTrace(); }
catch (ClassNotFoundException e) { e.printStackTrace(); }
catch (SQLException e) { e... |
6bd842ae-dc35-4a2f-bab4-52510fa88151 | 6 | public TestResult testResult(Object input){
TestResult result = new TestResult(false, "Parameter 'input' is null !");
if(input == null) return result;
//最先校验Required
if(ruleConfigs.containsTester(Rule.Required)){
Tester requiredTester = ruleConfigs.removeTester(Rule.Required);
result = requiredTester.test... |
38a8fb95-ebff-457d-a71e-9857576033ef | 9 | private void deleteEmptyDirectoryTree(String relativePath) throws IOException {
if (relativePath.trim().equals("")) {
throw new IllegalArgumentException("Empty relativePath.");
}
File dir = new File(mRootDirectory, relativePath);
if (!(dir.exists() && dir.isDirectory())) {
... |
221776e9-ffc7-4d8d-bafd-ac262656b7ac | 4 | public Boolean remove() throws SQLException{
int s = Database.removeAttunment(player, loc.getWorld().getName());
if (s > 0){
for (int i=players.get(player).size()-1;i>=0;i--)
if (players.get(player).get(i).equals(this))
players.get(player).remove(i);
if (players.get(player).size() == 0)
... |
6884d101-3b0f-4def-8d00-932eb18ea861 | 3 | public static String getComponentMessages(String clientComponent, String defaultMessage) {
FacesContext fc = FacesContext.getCurrentInstance();
UIComponent component = UIComponent.getCurrentComponent(fc).findComponent(clientComponent);
if (component instanceof UIInput) {
UIInput inpu... |
d7a546ad-e771-44c6-819c-d2ff0afb2a25 | 9 | public void sampleTable(int type, int table) {
double d = discount.doubleVal();
double c = concentration.doubleVal();
int[] tsa = tableMap.get(type);
int tt = 0;
int tc = -1;
for (int i = 0; i < tsa.length; i++) {
tc += tsa[i];
if (tsa[i] > 0) {
... |
0b7af2f4-ecca-4c0f-bb30-9bc6117870f7 | 7 | public void lataaHighScore() {
for (int i = 0; i < lista.size(); i++) {
lista.remove(i);
}
try {
lukija = new Scanner(ennatysLista);
} catch (FileNotFoundException ex) {
Logger.getLogger(Piirturi.class.getName()).log(Level.SEVERE, null, ex);
}
... |
e3587afe-d44d-4aeb-895c-2d83b9387473 | 2 | protected Duration restRecovery() {
Duration gap = lastWeekRest();
if (gap.isShorterThan(Rest.NORMAL.getValue())) {
DateTime start = period.getStart().minusWeeks(1);
DateTime end = period.getEnd();
Interval lastTwoWeek = new Interval(start, end);
Durat... |
b3a2320d-f972-4b67-b374-bb9569d6016b | 8 | public int ewtStraight(Block set, Material m, BlockFace bf) { int x = 1;
int a = gen.nextInt(40);
if (a < 12) {
a = 12;
}
while (x < a) {
int newx = x - 1;
Block otherset = set.getRelative(bf, newx);
Block set1 = otherset.getRelative(BlockFace.SOUTH, 1);
Block set2 = set1.... |
b23f8395-1cd9-4009-9a28-59df43b53de9 | 8 | public static void manageTime()
{
long currentTime=System.currentTimeMillis();
long time=currentTime-launchTime;
int parsedTime=(int)(time/Math.pow(10,3));
playTimeSecs=parsedTime%60;
if(!timeBoolean&&playTimeSecs%60==0)
{
playTimeMins++;
timeBoolean=true;
}
if(playTimeSecs%60==1)
timeBoolea... |
4a2335e3-28bc-47a4-8a73-5a9e56d64b75 | 2 | @Override
public int getPreferredWidth(Row row, Column column) {
Object data = row != null ? row.getData(column) : null;
return data instanceof StdImage ? ((StdImage) data).getWidth() : 0;
} |
24085aef-6a97-423e-aef1-af54ae589b78 | 4 | protected void framing(double inputSignal[]){
double numFrames = (double)inputSignal.length / (double)(frameLength - shiftInterval);
// unconditionally round up
if ((numFrames / (int)numFrames) != 1){
numFrames = (int)numFrames + 1;
}
// use zero pad... |
f303fcb2-3531-4378-8efa-f0085e2df5e3 | 3 | protected static String argTypesToString(int[] types, int[] dims,
String[] cnames) {
StringBuffer sbuf = new StringBuffer();
sbuf.append('(');
int n = types.length;
if (n > 0) {
int i = 0;
while (true) {
... |
bd8639f1-530c-4548-8199-ad9bfcaec950 | 5 | @SuppressWarnings({ "unchecked"})
public static void main(String[] args)
{
Graph G = null;
try
{
G = new Graph(new In(args[0]));
}
catch (Exception e)
{
System.err.println(e);
System.exit(1);
}
IConnectedComponents cc = new ConnectedComponents(G);
int M = cc.componentCount();
System.out... |
5f185ab3-afde-4088-9afe-44941f77dd3c | 0 | public void setDressCode(DressCode dressCode) {
this.dressCode = dressCode;
} |
948f9f3e-254a-489b-b388-108548432b69 | 3 | @Override
public void run()
{
try
{
inputStream = new DataInputStream(new BufferedInputStream(socket.getInputStream()));
outputStream = new DataOutputStream(new BufferedOutputStream( socket.getOutputStream()));
while (inputStream.available() != -1)
{
System.out.println();
int packetSize = ... |
b077c5f1-b737-4f9d-9121-6f6ce4faebf6 | 8 | private boolean r_verb() {
int among_var;
int v_1;
// (, line 136
// [, line 137
ket = cursor;
// substring, line 137
among_var = find_among_b(a_4, 46);
if (among_var == 0)
... |
1d4f16c9-b79f-4b2d-951a-e7f9275155af | 4 | public boolean equals(Object o) {
return (o instanceof Pair) &&
((((Pair)o).a == a && ((Pair)o).b == b) || (((Pair)o).a == b && ((Pair)o).b == a));
} |
16e3d844-3c04-40e0-a78d-c8a1f83430f7 | 0 | public boolean approved(Collection<String> networkMembers) {
Collection<String> cutSet = getCutSet(networkMembers);
return cutSet.size() >= DCConfig.MIN_NUM_KEYS;
} |
2eb524a6-1a0d-42ed-a605-88825c651c65 | 0 | public static void main(String[] args) {
DirTree dirTree = new DirTree();
dirTree.tree(new File("D:/VMware"));
} |
d11a4b5b-e5a9-4ec1-89d0-e17d1a23b59c | 8 | public Set<Map.Entry<Byte,Integer>> entrySet() {
return new AbstractSet<Map.Entry<Byte,Integer>>() {
public int size() {
return _map.size();
}
public boolean isEmpty() {
return TByteIntMapDecorator.this.isEmpty();
}
pu... |
c332e9b3-8900-473f-9be0-9e74700270f2 | 2 | public TicTacToeBoard() {
this.turn = PLAYER_X;
this.numEmptySquares = 9;
this.square = new String[SIZE][SIZE];
for (int row = 0; row < SIZE; row++) {
for (int col = 0; col < SIZE; col++) {
this.square[row][col] = BLANK;
}
}
} |
16f27213-f7cc-476f-be04-0d70fd2936bf | 4 | public void paint(Graphics paramGraphics)
{
nullCheck();
Graphics localGraphics = this.dblbuffer.getGraphics();
int i = getSize().width / 50;
int j = getSize().height / 50;
Map localMap = this.mapref.getMap();
for (int k = 0; k < localMap.getSize().width; k++)
{
for (int m = 0; m <... |
56e4fab3-1400-4fc6-8006-f130e28d3a01 | 6 | private void init(){
setLayout(gridLayout);
nameLabel=new JLabel("name: ");
priceLabel=new JLabel("price: ");
quantityLabel=new JLabel("quantity: ");
descriptionLabel=new JLabel("description: ");
nameTextField=new JTextField();
priceTextField=new JTextField();
priceTextField.addKeyListener(new Key... |
47c93846-b0b0-4126-9102-593a59ad45d3 | 5 | public static void main(String[] args)
{
System.out.println("Starting GIS-network examples ...");
try
{
//////////////////////////////////////////
// Variables that are important to this example
int num_user = 1; // number of grid users
... |
f4948bfa-c77a-4b78-a9fd-b87769000792 | 8 | public void validaCamposEmpresa(String nomeFantasia, String cpf, String telefone) {
if (txt_nomeFantasia.getText().isEmpty()) {
JOptionPane.showMessageDialog(null, "Nome Fantasia inválido!");
txt_nomeFantasia.requestFocus();
} else {
if ((cbx_tipo.getSelectedItem().to... |
ca427a51-462d-4e35-ac11-cebf55baaa88 | 2 | private static void printHelpThenExit() {
System.out.println("Syntax: -conf \"path-to-config-file.json\"");
try {
InputStream stream = LessNow.class.getResourceAsStream("/res/help-syntax.txt");
BufferedReader reader = new BufferedReader(new InputStreamReader(stream, "UTF-8"));
String line;
while ((line ... |
1c703c86-f1ff-4b78-b9d5-4539cd998f97 | 7 | public void storeFormResponse(int userId, int formId, FormResponse resp) throws
VoteNotStoredException, InvalidVotingUserException, FormNotFoundException, UserAlreadyVotedException {
try {
if(!this.isValidFormVoter(userId, formId)) {
throw new InvalidVotingUserException()... |
bc4f96af-4741-4e76-8cf1-955cf1760327 | 0 | public void testDistanceBetweenTwoPoints() {
double distance = MathUtils.distanceBetweenTwoPoints(0, 0, 3, 3);
assertEquals(Math.sqrt(18), distance, 0);
distance = MathUtils.distanceBetweenTwoPoints(0, 0, 0, 0);
assertEquals(0, distance, 0);
distance = MathUtils.distanceBetweenTwoPoints(1, 1, 3, 3);
a... |
e0e455cb-d15f-4f11-a32f-d855fdb9dcca | 2 | public int port() {
int p = 9001;
if (portbox.getText() != ""){
try{
p = Integer.parseInt(portbox.getText());
}catch (Exception e){
JOptionPane.showMessageDialog(null, "Given Port Incorrect");
}
}
return p;
} |
eca4fe01-659b-4325-ab7a-61660be27972 | 8 | void execute() {
boolean en = true;
if (hasEnable())
en = pins[bits+2].value;
if (pins[0].value && !lastClock && en) {
int i;
for (i = bits-1; i >= 0; i--) {
int ii = i+2;
if (!pins[ii].value) {
pins[ii].value = true;
break;
}
pins[ii].value = false;
}
}
if... |
9513f0f7-4b9d-474a-82dd-3b85e58aff48 | 2 | private boolean hasTag(String version) {
for (final String string : Updater.NO_UPDATE_TAG) {
if (version.contains(string)) {
return true;
}
}
return false;
} |
a001b36e-1c91-40b3-8962-17064dc3e81a | 5 | private void _extractShapes(Reader reader) throws XMLStreamException {
XMLEventReader xrd = fct.createXMLEventReader(reader);
shapeCoordString.clear();
while (xrd.hasNext()) {
XMLEvent xev = xrd.nextEvent();
if (xev.isStartElement()) {
String tagName = xev... |
5d029a0d-a981-44c9-aba4-5da81a92f7bd | 9 | public void update(Observable board, Object o){
Location temp = null;
if (o instanceof NotifyReveal){
int type = ((NotifyReveal) o).getType();
temp = ((NotifyReveal) o).getLocation();
if(type == 0){
this.drawBlank(temp);
}
else{
drawNumbers(type, temp);
}
}
else if(o instanceof NotifyF... |
b8df6f83-76ea-4da4-ba81-f7f2d50ac21f | 9 | public ParseException generateParseException() {
jj_expentries.clear();
boolean[] la1tokens = new boolean[46];
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 3; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
if... |
140cfe01-1f45-40f3-9e65-3d10cf2ead55 | 2 | private void rotateImages(int rotateDegree){
Hashtable<String, BufferedImage[]> copyAnimations = new Hashtable<>();
Iterator<Entry<String, BufferedImage[]>> it = animations.entrySet().iterator();
SoccerImageLoader sImgLdr = new SoccerImageLoader();
while(it.hasNext()){
Entry<String, BufferedImage[]> entry = ... |
7eed60a0-0b06-4e9a-9229-e05671e56730 | 6 | @EventHandler
public void mobSpawn(CreatureSpawnEvent event){
LivingEntity creature = event.getEntity();
if(creature.getCustomName() == null){
Location loc = creature.getLocation();
if(plugin.isInRegion("Town", loc) || plugin.isInRegion("ghetto", loc)){
if(event.getSpawnReason() == SpawnReason.N... |
0c58659c-8bfb-44c4-8a2f-87723cccbc97 | 9 | private void internalRegisterEvents(Listener listener) {
if (listener != null) {
Method[] methods = listener.getClass().getMethods();
for (Method method : methods) {
if (method.getAnnotation(EventHandler.class) != null) {
Class<?>[] parameters = method.getParameterTypes();
if (parameters.length ==... |
a62ae704-084f-496a-af5b-088b5133d976 | 6 | public void setLcLpPb(int lc, int lp, int pb) {
if (
lp < 0 || lp > Base.kNumLitPosStatesBitsEncodingMax ||
lc < 0 || lc > Base.kNumLitContextBitsMax ||
pb < 0 || pb > Base.kNumPosStatesBitsEncodingMax) {
return;
}
_numL... |
e591135c-4c5a-4249-af58-9e057a28f499 | 1 | public Type pop() {
if (size < 0)
throw new IndexOutOfBoundsException("No more items in the stack!");
Type data = first.data;
first = first.next;
size--;
return data;
} |
f0c279a6-e39a-4db9-8119-793be621ded4 | 2 | public Chessboard()
{
fields = new Field[NUMBER_OF_ROWS][NUMBER_OF_COLUMNS];
char row = 0;
byte column = 0;
for(int r = 0; r < NUMBER_OF_ROWS; r++)
{
row = (char) (FIRST_ROW + r);
co... |
88f398d1-2b7e-403e-951e-77f2690930cc | 8 | public void Calculate() throws ExecutionException, InterruptedException {
//Spin the snowflake
imgCalculate.setVisible(true);
imgCalculate.setImage(new javafx.scene.image.Image(getClass().getResourceAsStream("/image/snowflake_blue.png")));
rt = new RotateTransition(Dura... |
1adde114-dc02-40f9-8cc6-9296ff0ba9b1 | 2 | private Expression noteOn(List<Expression> args, String caller) {
// check to make sure we got the right number of arguments
if ( args.size() != 4 ) {
System.err.println("noteOn expected 4 arguments and got " + args.size() );
return new Void();
}
long msgTime = S... |
cc3db1f2-a521-4edc-8b2b-242032d7e93f | 9 | public CgiResponse(String body) {
// Process the header of the
Scanner reader = new Scanner(body);
while(reader.hasNextLine()) {
// Break out on a blank line
String line = reader.nextLine();
if(line.equals("\r\n") || line.isEmpty()) {
break;
... |
7dab3542-0f6d-453e-899b-fcfdf87b8cac | 0 | public void setHtmlCode(String htmlCode) {
this.htmlCode = htmlCode;
} |
ecc2af07-f769-44a2-9821-7bbd982d3de3 | 7 | public Credential getSingleSignOn(HttpRequest request,
HttpResponse response)
{
String ssoID = null;
Cookie[] cookies = request.getCookies();
for (int i = 0; i < cookies.length; i++)
{
if (cookies[i].getName().equals(SSO_COOKIE_NAME))... |
c939df9c-cd79-487d-be82-11f3d765fff3 | 1 | public SQLite(String dir, String dbName)
{
loadDriver();
File dirCheck = new File(SignURLs.getPlugin().getDataFolder().getPath());
if(!dirCheck.exists()) dirCheck.mkdirs();
url = "jdbc:sqlite:" + dir + File.separator + dbName + ".sqlite";
openConnection();
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.