method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
59c8bd45-e8a7-463b-89ff-c9ce6c25122b | 2 | public static User getUserByUsername(String username, ArrayList<User> users) {
// search for user from array of users
for (User u : users) {
if (u.getUsername().equalsIgnoreCase(username)) {
return u;
}
}
return null;
} |
cb17f0d9-6b00-46be-a9e5-ecf2605e1bd4 | 1 | private boolean jj_2_1(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_1(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(0, xla); }
} |
f34ac0ce-5a59-41d0-95e8-40d6be3391ff | 3 | public boolean removeFreeTile(int x, int y) {
for (int i = 0; i < freeTiles.size(); i++) {
Tile t = freeTiles.get(i);
if (t.getX() == x && t.getY() == y) {
freeTiles.remove(i);
return true;
}
}
return false;
} |
650a40e3-04d5-409f-befa-d55e62e18fd7 | 8 | private String comboList(){
if(currentComboNo == 1){
return "Punch1";
}
if(currentComboNo == 2){
return "Punch2";
}
if(currentComboNo == 3){
return "Kick";
}
if(currentComboNo == 4){
return... |
fde1e2d4-22ac-4d6c-8783-4a60ac92d81e | 9 | public static MethodData read(ClassData classData, MethodInfo methodDesc) throws FormatException {
String methodName = methodDesc.resolveName();
String descriptor = methodDesc.resolveDescriptor();
List<Type> params = extractParamTypes(descriptor);
Type returnType = extractReturnType(des... |
5389b5a2-b7fa-4c4e-8bea-587059ac0e10 | 2 | public String subMessage(String message, String pName, Integer remWarnings) {
String remWarningRegex = "%remwarning%";
String sRegex = "%s%";
String nameRegex = "%player%";
String actionRegex = "%action%";
String action = (getBanAction()) ? "banned" : "kicked";
String s = (remWarnings == 1) ? "" : "s";
me... |
db630b6b-a4ec-4fc6-8893-3d1efe3f8d4f | 9 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, SQLException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
String userType = "Guest";
String firstNam... |
3c44510e-8d7c-498e-9313-4cafd314b1a1 | 1 | public PacketFactory(int totalNumberOfPackets,int packetSize, int totalNumberOfInputBuffers, long SEED)
{
//initialize the seed used by the simulator
this.SEED = SEED;
//initialize the random
rnd = new Random(this.SEED);
//initialize the packet sequence
sequence = 1;
... |
456cf867-9c5f-4096-82c8-1bb10b024a0f | 8 | @Override
public String execute() throws Exception {
HttpSession session = ServletActionContext.getRequest().getSession();
User user = (User) session.getAttribute(com.ccf.action.user.UserLoginAction.USER_SESSION);
if (user == null)
return LOGIN;
if (action == null || cid == null || sender == null || rece... |
10e1a512-3928-4ad4-b8d6-0c8f73c7a1b6 | 8 | public Object getField(Integer field) {
switch(field) {
case 1:
return field1;
case 2:
return field2;
case 3:
return field3;
case 4:
return field4;
case 5:
return field5;
... |
668954fe-994a-46f2-ae60-37e1454357fb | 4 | ImmutableListIterator<? extends T> current() {
if (current == null) {
l = left.iterator();
current = l;
}
if (current == l && !current.hasNext()) {
r = right.iterator();
current = r;
}
return curr... |
416b25d9-1ca1-490d-94e3-50fa2f1fb8a1 | 9 | public static Alignment score_all_refs(String hyp,
List<String> refs,
List<String> reflens,
List<String> refids,
String refspan,
String hypspan,
CostFunction costfunc,
TerScorer calc) {
double totwords = 0;
String ref;
String refid = "";
... |
429d41ca-4db8-42a2-98cb-ee0e061c485b | 3 | public List<String> loadExclusionWords(File path) throws FileNotFoundException, IOException {
List<String> list = new ArrayList<>();
BufferedReader br = new BufferedReader(new FileReader(path));
while (br.ready()) {
String line = br.readLine();
if (line.trim().length() > ... |
834f4044-9e1c-4ed3-982f-439a764edcac | 3 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
try{
CashPurseAccount cashPurseAccount = new CashPurseAccount();
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
boolean isSuccess = cashPurseAccount.dep... |
08a64502-ef79-46b8-afdc-6be34e871e85 | 5 | public static void inBattle(){
while (GlobalParams.inBattle) {
new Enemy(GlobalParams.enemyName);
System.out.println("Чем нанести удар?");
System.out.println("Кулаки - 1");
if (GlobalParams.swordWeapon){System.out.println("Мечь - 2");}
new ToSay(ToSay.key);
if (ToSay.key.equals(GlobalPar... |
56a78a11-2f41-4af9-a198-4a3724544adb | 6 | public static void main(String args[]) {
/*
* Set the Nimbus look and feel
*/
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/*
* If Nimbus (introduced in Java SE 6) is not available, stay with the
* default look and fe... |
fa69af6e-9daa-43f6-96b1-d0be414c15f2 | 5 | public static List<Long> parseLongList(final Context context, final int position) {
if (position < 0 || context.arguments.size() <= position) return null;
final List<Long> values = new ArrayList<Long>();
for (final String s : context.arguments.get(position).split(","))
try {
... |
e7279863-c8db-4a44-8dcd-37945e58cee9 | 1 | public static void main(String[] args)
{
try {
EventQueue.invokeLater(new Runnable() {
@Override
public void run()
{
new MainWindow().setVisible( true );
}
});
}
catch(Exception exc)
... |
7949ab1a-0ca0-4aa3-a8f1-4a041786a296 | 9 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking,tickID))
return false;
if(tickID==Tickable.TICKID_MOB)
{
if(nextDirection==-999)
return true;
if((theTrail==null)
||(affected == null)
||(!(affected instanceof MOB)))
return false;
final MOB mob=(MOB... |
aab66391-795a-42c9-8fa2-7769c5b68974 | 4 | public AutomatonType getAutomatonType(){
if(this.type!= null)
if(this.type.equals("AFD"))
return AutomatonType.AFD;
else if(this.type.equals("AFN"))
return AutomatonType.AFN;
else if(this.type.equals("AFNE"))
return AutomatonTy... |
db42409c-35df-421e-a312-7f2f1742d0af | 3 | public Entity findEntity(int ID, String layerName) {
Layer L = findLayerByName(layerName);
if (L != null) {
for (Entity e : L.getEntList() ) {
if (e.getID() == ID) {
System.out.println("FoundEntity");
return e;
... |
ebe3843f-c65f-431e-8bb1-459d071ee98f | 7 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=prof... |
2c442e6e-60f5-42f0-8b57-17a3a2fa05c7 | 6 | @Override
public void close() {
// TODO Auto-generated method stub
if(os != null){
try {
os.flush();
os.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
os = null;
}
if(is != null){
try {
is.close();
} catch (IOException e) ... |
9e52e851-3081-42be-9e3b-35fd3b71a829 | 8 | static Method getMethod(Class cls,String name,Object [] args) {
Class [] args_cls = new Class[args.length];
for (int i=0; i<args.length; i++) {
if (args[i] instanceof Boolean) {
args_cls[i] = Boolean.TYPE;
} else if (args[i] instanceof Character) {
args_cls[i] = Character.TYPE;
} else if (args[i] i... |
45c49507-2ece-4e30-be5d-cdb6c823cf85 | 1 | @Override
public boolean equals(Object other){
if(other instanceof HttpBodyResponse){
HttpBodyResponse otherBody = (HttpBodyResponse) other;
return contenido.equals(otherBody.contenido);
}
return false;
} |
4583f9dd-119e-4d1e-8011-e4c84a29f45b | 3 | public Song getPlayed() {
if (isPaused) {
MyTunes.playerThread.resume();
Song ret = isPlaying() ? current : null;
MyTunes.playerThread.suspend();
return ret;
}
return isPlaying() ? current : null;
} |
a556d4f9-00ab-41e6-be96-beeabf9b8f27 | 2 | public static String trim(String message)
{
while (message.startsWith(" ")) {
message = message.substring(1);
}
while (message.endsWith(" ")) {
message = message.substring(0, message.length() - 1);
}
return message;
} |
69dcaea0-9bb0-4126-8695-d2c29bd85ab7 | 7 | void frameFromCds() {
for (Exon ex : this) {
// No frame info? => try to find matching CDS
if (ex.getFrame() < 0) {
// Chech a CDS that matches an exon
for (Cds cds : getCds()) {
// CDS matches the exon coordinates? => Copy frame info
if (isStrandPlus() && (ex.getStart() == cds.getStart())) {
... |
f8aa9e29-6204-43f2-83bb-99c77f3d2196 | 2 | private boolean jj_3_13() {
if (jj_scan_token(COMMA)) return true;
if (jj_3R_31()) return true;
return false;
} |
2f29800c-08a5-4b92-93a2-7991702680e8 | 4 | @Override
public void run(Player activator, List<Player> allPlayers) {
for (Player player : allPlayers){
int[][] strength = player.getBoard().getStrengthMap();
for(int i = 0; i<strength.length; i++){
for(int j = 0; j<strength[0].length; j++){
if (strength[i][j] == 1) strength[i][j]++;
}
}
... |
b4656a81-0b32-4c3f-a099-ca105dbf9a9e | 2 | public void run(String[] args) throws FileNotFoundException, IOException {
try {
if (PCSCManager.getCard() != null) {
PCSCManager.disconnect();
} else {
Logger.log("Desconectado com sucesso.");
}
} catch (CardException e) {
}
... |
495e93d6-d2d1-4f7a-9364-729a68d36260 | 2 | public static String capitalize(String s) {
final String c = Strings.toString(s);
return c.length() >= 2 ? c.substring(0, 1).toUpperCase() + c.substring(1) : c.length() >= 1 ? c.toUpperCase() : c;
} |
5c87d900-d515-4a58-b4ed-a68278033ce2 | 4 | @Override
public boolean accept(File dir, String name) {
for(String s : extensions)
{
if((name.toLowerCase().endsWith(s+".xml") || name.toLowerCase().endsWith(s+".bin")) && new File(dir,name).exists())
return true;
}
return false;
} |
c3cee4c5-0fd0-479f-af9e-a82af994cd04 | 4 | @Override
public int loop() {
if(startscript) {
if(task == null || !task.hasNext()) {
task = container.iterator();
} else {
final Node curr = task.next();
if(curr.activate()) {
curr.execute();
}
}
}
return stop;
} |
53c345ca-fbcd-4895-9823-d0da6fadd27d | 5 | @Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
boolean hasFocus, int row, int column){
super.getTableCellRendererComponent(table,value,isSelected,hasFocus,row,column) ;
//System.out.println("RenduCelluleLocation::getTableCellRendererCompo... |
60c8ec7a-ac2f-424a-9576-9ccbd0802def | 3 | private boolean jj_3R_77() {
if (jj_scan_token(VAR)) return true;
if (jj_3R_72()) return true;
if (jj_scan_token(IS)) return true;
return false;
} |
cba7081e-8513-4a37-9079-f5d45b27f2d1 | 6 | public int uniquePaths(int m, int n) {
if (m <= 0 || n <= 0) {
return 0;
}
int[][] paths = new int[m][n];
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
if (i == 0 || j == 0) {
paths[i][j] = 1;
} else {
paths[i][j] = paths[i - 1][j] + paths[i][j - 1];
}
}
}
... |
79b155d3-3280-4900-8b0f-c7aaee983b98 | 8 | public Stage1WordRtProcessor(File uniFile, File binTrigramFile, Measure sim)
throws IOException, ProcessException {
BinaryFileFastRecordReader fastReader = new BinaryFileFastRecordReader(binTrigramFile);
try {
fastReader = new BinaryFileFastRecordReader(binTrigramFile);
Map... |
2bc752b7-d6dc-4577-b690-6b2c2827786b | 9 | public void insertText(XmlMarshallingContext ctx, String fieldText) {
if (fieldText == null && isLazy()) {
return;
}
if (fieldText == Value.NIL) {
fieldText = null;
}
Document document = ctx.getDocument();
Element element = docume... |
9af8f1e5-7e2d-4442-be37-265b6c338dbb | 1 | public AnnotationVisitor visitAnnotation(final String name,
final String desc) {
++size;
if (named) {
bv.putShort(cw.newUTF8(name));
}
// write tag and type, and reserve space for values count
bv.put12('@', cw.newUTF8(desc)).putShort(0);
return new AnnotationWriter(cw, true, bv, bv, bv.length - 2);
} |
18c55abb-773b-41d0-b4e9-b1f6a0d15656 | 8 | public void init() {
System.out.println("INIT");
setLayout(new BorderLayout());
String tmp_props=getParameter("properties");
if(tmp_props != null) {
System.out.println("Setting parameters " + tmp_props);
props=tmp_props;
}
try {
chan... |
9682e4c3-95c3-400a-804d-3fe9d8600a7b | 7 | static void solveBack(String s, int r, int c) {
if (founded)
return;
if (s.length() == word.length()) {
if (!founded) {
founded = true;
score += score(word.length());
}
} else
for (int[] d : dir)
if (check(r + d[0], c + d[1]) && !u[r + d[0]][c + d[1]]
&& word.charAt(s.length()) == a... |
75b8518a-6a79-4cc0-be79-c469612bc8a3 | 7 | @Override
public final void mouseDragged(MouseEvent me)
{
if (slider.inUse)
if (orientation == VERTICAL)
{
slider.y = me.getY() - 12.5f;
if (slider.y < y)
slider.y = y;
else if (slider.y > y + length - 25)
slider.y = y + length - 25;
sendTScrollEvent(new T... |
0c9680e1-e099-4736-a037-7ec3da9d1cc9 | 1 | public static void load(ConfigurationSection config) {
for (Msg msg : values()) {
// MISC_NO_PERMISSION will become misc-no-permission
String key = msg.name().toLowerCase().replace("_","-");
msg.set(config.getString(key, ""));
}
} |
e8278f84-b1a0-401d-b8a6-8c67aba5d559 | 3 | @Override
public void actionPerformed(ActionEvent e) {
switch(e.getActionCommand()){
case DRAW_AUTOMATON:
Application.mediator.showAutomatonFrame();
break;
case DRAW_ALGO:
Application.mediator.algPanel.draw... |
50211767-371d-4ee1-989b-1cfeb176a3b6 | 2 | private boolean paikkaSisaltyySyotteeseen() {
if (paikka >= 0 && paikka < syote.length()) {
return true;
}
return false;
} |
1b274614-06cc-4e50-a658-3b83449f8149 | 1 | public ArrayList<BESong> searchSongs(String searchWord) throws SQLException {
ArrayList<BESong> result = new ArrayList<BESong>();
Statement stm = DBConnection.getConnection().createStatement();
stm.execute("select * from Song inner join Artist on Artist.ID = Song.ArtistID "
+ "w... |
6f255d60-e307-4a38-9040-c945d586833e | 6 | private void setSelectedGroup(String value) {
try {
ParameterGroup p = null;
switch (selection) {
case "Elevation" :
selected_group = (ParameterGroup) Parameters.getParameterSet("general").getParameterNode(
"terrain.elevation");
break;
case "Temperature" :
selected_group = (Parameter... |
304c7619-a386-4e13-9037-7490ecd505ca | 9 | public int numTouching(int piece, int column) {
int counter = 0;
int row = findRow( column );
for (int x = -1; x <= 1; x+=2) {
for (int y = -1; y <= 1; y++ ) {
if ( (row + x) < 6 && (row + x) > -1 && (column + y) < 7 && (column + y) > -1) {
if (_board[row+x][column+y] == piece){
counter++;
}
... |
4d77a601-0f93-41ab-a201-7c6c3ef4356d | 0 | public ArrayList<Serie> getListeTags() {
return listeSeries;
} |
24fd9d71-d085-45ca-888e-cfd5bba07a57 | 0 | default void log(String str){
out.println("I1 logging::"+str);
} |
e0ddf02e-ec24-42d2-80aa-41ac245f65c6 | 9 | public static void checkComponentsFocusable(
final Component _rootComponent) {
if (_rootComponent.isFocusable()) {
System.out.println( "Focusable: \t" +
_rootComponent.getClass().getSimpleName()
+ _rootComponent.getSize()
);
}
if (_rootComponent instanceof JPanel) {
for (Component x :... |
3f57d8c8-367d-4449-8103-7a69297a9738 | 5 | @Override
public boolean canInsert(int row, int column, int value) {
Cell cell = getSudoku().getCell(row, column);
Integer sumIndex = (Integer) cell.getValue(SumCellProvider.SUM);
if (sumIndex == null) {
// System.out.println("sumIndex == null -> true");
return true;
}
@SuppressWarnings("unchecked")
... |
ff966afe-b3d3-4bdb-9859-6b3c491d7746 | 6 | public int[] addScore(int score[],boolean p1, boolean p2){
if(p1==true && p2==true){
score[0]+=prize;
score[1]+=prize;
} else if(p1==true && p2==false){
score[0]+=nerd;
score[1]+=temptation;
} else if(p1==false && p2==true){
score[0]+=t... |
d15e1f62-07a6-42c8-9a5f-f43a2e99a139 | 4 | private static void doUpdate() throws Exception
{
/* Remove preferences file (get rid of the provider word) */
(new File("prefs.dat")).delete();
/* Modify Intermarche file (get rid of the provider word) */
String InterName = (new Intermarche()).getName();
LookAheadIS in = null;
OutputStream out = null;
t... |
04ac0bb1-e2dd-49f2-b173-52658f825217 | 4 | public void add() {
Object[] classes;
int index = -1;
System.out.println("Select your new equipment.");
try {
// Retrieve all classes in the package 'equipment.solid'.
classes = PackageHelper.getInstance()
.getClasses("equipment.solid", fa... |
2639a408-3b80-47f0-a6f2-93a8e768765e | 2 | public void fixStartEnd() {
if (sstart > send) {
int t = send;
send = sstart;
sstart = t;
}
if (qstart > qend) {
int t = qend;
qend = qstart;
qstart = t;
}
} |
4e416d33-4f0e-4750-ac7c-709533ae9b3d | 0 | public ClothBodyArmor() {
this.name = Constants.CLOTH_BODY_ARMOR;
this.defenseScore = 10;
this.money = 300;
} |
58fa460b-a578-4bcc-ae2e-538a9b462b2f | 0 | public void setEmail(String email) {
this.email = email;
} |
8b59fd56-efdf-444f-914a-f79d98da0cd6 | 2 | private void lab(EnvironnementAbs environnement){
int x;
int y;
x = environnement.taille_envi/2;
for(y = environnement.taille_envi/8; y < environment.taille_envi-(environnement.taille_envi/8) + 1; y++){
environment.grille[x][y] = new Mur("Mure", x, y);
environment.grille[y][x] = new Mur("Mure", y, x... |
3307c456-fe02-449d-9b43-e80d1b3cd449 | 0 | public void pointerPressed(int x, int y)
{
clear();
} |
efbe2c2e-6754-419c-9ded-1f56fd1181a9 | 7 | public boolean tarkistaYhtenaisyys(Palikka palikka) {
ArrayList<int[]> muoto = palikka.getMuoto();
if (muoto.isEmpty()) {
return true;
}
int i = 0;
while (i < muoto.size()) {
int[] piste1 = muoto.get(i);
boolean vieruksia = false;
... |
0dc78265-e2d0-4b10-bf48-8620611676f7 | 4 | private void format() {
StringBuilder sb = new StringBuilder();
sb.append(country != null ? country.name() : "")
.append(":")
.append(organisation != null ? organisation : "")
.append(":")
.append(datasetType != null ? datasetType.name() : "")
.append(":")
.append(serial != n... |
e20ea3c1-a362-45c2-bfcc-660d8484cdb1 | 1 | private static void checkDepth(EvalContext evalContext) {
int depth = evalContext.depth();
if(depth>maxDepth)
maxDepth = depth;
} |
b2be5b6a-af9b-4898-b537-298aee43be3f | 3 | public boolean checkAccusation(Solution solution){
boolean correct = false;
if(solution.getPerson().equals(answer.getPerson()) && solution.getRoom().equals(answer.getRoom()) && solution.getWeapon().equals(answer.getWeapon())) {
correct = true;
}
return correct;
} |
bdbed30b-8930-4526-ba95-70cc12383329 | 4 | public Config(SSGlobals glob) throws FileNotFoundException
{
fCarImages = new Vector<ImageIcon>();
try
{
parseConfig(glob);
setCarImages();
}
catch (ParserConfigurationException e)
{
throw new FileNotFoundException("Die Konfigurationsdatei konnte nicht gefunden werden");
}
catch (IOException e... |
de104ff3-4849-4591-80eb-43545ec9930c | 8 | public int find(int[] A, int sta, int end,int target,boolean flag){
if(sta > end)
return -1;
else{
int mid = (sta + end) / 2 ;
if(A[mid] == target){
if(flag){
//find minIndex
int index = mid-1;
... |
8ed6555c-19e5-458e-a34f-e16baa9277cf | 4 | public MethodIdentifier(ClassIdentifier clazz, MethodInfo info) {
super(info.getName());
this.name = info.getName();
this.type = info.getType();
this.clazz = clazz;
this.info = info;
BytecodeInfo bytecode = info.getBytecode();
if (bytecode != null) {
if ((Main.stripping & Main.STRIP_LVT) != 0)
inf... |
91376b6b-3f67-4a27-83a0-0e1b6a13031a | 2 | public Role getConsultationRoleMinimum() {
if (consultationRoleMinimum == null)
if (getCategorieParent() != null)
return getCategorieParent().getConsultationRoleMinimum();
else
return Role.Visiteur;
return consultationRoleMinimum;
} |
c6b7ffca-3414-4636-ad07-97015936ba31 | 4 | public boolean checkColumn (int col) {
int i = 0, j = 0, count = 0;
/* Uses nested for loops to check the entries in the column */
for (j = 0; j < 10; j++) {
count = 0;
for (i = 0; i < 9; i++) {
if (j == Integer.parseInt(entries[i][col].getText())) {
count++;
}
if (count >= 2) {
... |
8e1ced4b-2126-4350-8e5b-81466d30bfa6 | 4 | public Object nativeToJava(TransferData transferData){
if (isSupportedType(transferData)) {
byte[] buffer = (byte[])super.nativeToJava(transferData);
if (buffer == null) return null;
MyType[] myData = new MyType[0];
try {
ByteArrayInputStream in = new ByteArrayInputStream(buffer);
DataInputStream ... |
cb4d9f94-fd95-4ca3-b809-3fc95f80965f | 4 | public static void setRegionStyle(HSSFSheet sheet, CellRangeAddress region )
{
int rowFrom = region.getFirstRow();
int rowTo = region.getLastRow();
int colFrom = region.getFirstColumn();
int colTo = region.getLastColumn();
for (int i = rowFrom; i <= rowTo; i ++)
... |
b772ebff-1db8-412d-a763-3adfcd931f5c | 3 | public int GetActionTakenCount(ACTION action)
{
if(action == ACTION.UP)
{
return this.numUpTaken;
}
else if(action == ACTION.DOWN)
{
return this.numDownTaken;
}
else if(action == ACTION.LEFT)
{
return this.numLeftTaken;
}
else
{
return this.numRightTaken;
}
} |
fac0e99c-e408-4b85-9dca-70e19b0ced95 | 8 | static String toHex8String(int pValue)
{
String s = Integer.toString(pValue, 16);
//force length to be eight characters
if (s.length() == 0) {return "00000000" + s;}
else
if (s.length() == 1) {return "0000000" + s;}
else
if (s.length() == 2) {return "000000" + s;}
else
if (s.lengt... |
a7dd0a00-8fdb-4aa1-97d3-6de4e8f79b7c | 5 | @Override
public int unlink(String path) throws FuseException {
if (fileSystem.isReadOnly())
return Errno.EROFS;
try {
if (DirectoryInfo.class.isInstance(fileSystem.getFileMetaData(path)))
return rmdir(path);
} catch (PathNotFoundException e) {
return Errno.ENOENT;
}
try {
fileSystem.deleteFi... |
83c75f6d-505a-49a8-8e73-f25669011205 | 8 | public Pair<List<Sentence>, Double> getBestSentiment (ScoreFunction func, int sentiment, int minLength, int maxLength, int delta, int windowSize) {
double highscore = Double.MIN_VALUE;
List<Sentence> bestSentences = null;
for (Pair<Integer, Integer> boundaries : chooseTwo(sentences.size())) {
int start = bo... |
0055daae-5eab-45f5-a26d-df22867086a1 | 4 | @Override
public E poll()
{
E item = queue.poll();
if (blocking && item == null) {
synchronized (lock) {
// Only block if the item is null, else return it.
item = queue.poll();
if (item == null) {
try {
lock.wait(timeout);
} catch (InterruptedException e) { }
item = queue.poll... |
f5973514-f4d7-4e8b-8712-921573ad96e2 | 6 | public List<String> getUserList(String service, String userType) {
List<String> users = new Vector<String>();
BufferedReader br = getFileReader();
String currentLine, user, tmpService;
StringTokenizer strTk;
if(br == null) {
System.err.println("Error opening file");
System.exit(1);
}
try {
... |
d69e7627-fc55-492e-b4a1-ad1c080dd3af | 3 | @Override
public Action getActionLocal(Server server, Instruction instruction,Option[] options) {
Context context = null;
try{
context = createContext(server);
}catch(Exception e){
}
if(null == context)
return null;
try{
Deploy deploy = server.findDeploy(instruction);
String bindi... |
f58ac382-6bfc-4ce4-8e67-78b00c1eaf80 | 4 | private static void AutoAddConnectionsInOnePage(Robot robot, boolean isZhu) {
if (isZhu) {
int startX = 330;
int startY = 350;
for (int j = 0; j < 5; j++) {
for (int i = 0; i < 1; i++) {
MoveAndLeftClickTwice(robot, startX, startY, 1000);
MoveAndLeftClickTwice(robot, startX + 450, startY, 1000... |
95562e15-2f7d-440d-85e6-19606e565657 | 7 | @Override
public boolean equals(Object obj) {
EntityData other = (EntityData) obj;
if (id == other.id && x == other.x && y == other.y && angle == other.angle && velocity == other.velocity
&& removed == other.removed && Arrays.equals(specificData, other.sp... |
cffad69c-2e38-417c-993a-ef498a4ead07 | 4 | public JLabel getPlayer1Piece() {
boolean test = false;
if (test || m_test) {
System.out.println("Drawing :: getPlayer1Piece() BEGIN");
}
if (test || m_test)
System.out.println("Drawing:: getPlayer1Piece() - END");
return m_player1Piece;
} |
d90e4652-9f5e-46d9-9f9e-68ee03334113 | 4 | public Point getPointX(int x, int y) {
//0 30 60 90 120
int rangeX = (int) Math.round(side * 1.5);
int roundedPointX = x / rangeX;
// System.out.println(roundedPoint);
int offsetX = x % rangeX;
int realPointX = (offsetX-(rangeX/2)<0)? roundedPointX*rangeX:(roundedPointX*ra... |
9b70e18d-bb44-4d6c-b772-6e0ec9433611 | 9 | public static Object getValueClass(char ch)
{
switch (ch)
{
case '@':
return PatternOptionBuilder.OBJECT_VALUE;
case ':':
return PatternOptionBuilder.STRING_VALUE;
case '%':
return PatternOptionBuilder.NUMBER_VALUE;
... |
6fb1b0df-6114-4861-9633-1e9ea473add8 | 6 | private void initializeBoard() {
Letterpress.board = new char[5][5];
Random gen;
switch (LGameManager.runState) {
case DEBUG:
gen = new Random(0);
break;
case RUN:
gen = new Random();
break;
case TEST:
gen = new Random();
break;
default:
gen = new Random();
break;
}
for (int r... |
88998c3a-a5ad-47f5-abaa-6bc0b5a34c02 | 4 | public static int checkAlignment(JTextPane pane)
{
AttributeSet attributes = pane.getParagraphAttributes();
if (attributes.isDefined(StyleConstants.Alignment))
{
Integer align = (Integer) attributes
.getAttribute(StyleConstants.Alignment);
return align.intValue();
}
if (attributes.isDefined(CSS.... |
bfd6aabd-99eb-4fc5-82fa-9267f3959d30 | 5 | public String getOOXML()
{
StringBuffer ooxml = new StringBuffer();
if( dvRecs.size() > 0 )
{
ooxml.append( "<dataValidations count=\"" + dvRecs.size() + "\"" );
if( !isPromptBoxVisible() )
{
ooxml.append( " disablePrompts=\"1\"" );
}
if( getHorizontalPosition() != 0 )
{
ooxml.append( "... |
cf197912-b74f-4dff-8ae2-65fd81f827f0 | 9 | public void step() {
steps++;
Point pacManLoc = board.getPacManLocation();
board.move(pacManLoc.x, pacManLoc.y, pacManDirection);
// ... and now, on to the ghosts. We'll leave the actual AI work to a
// separate method in any class implementing the AI interface, focusing
... |
99e38898-8f78-43f6-9f56-dde8d277d4e8 | 4 | public void dataQueHandling() {
Thread messageHandling = new Thread() {
public void run(){
while(true){
Packet packet = dataQue.poll();
if(packet != null) {
if(packet.channel != null){
for(int handlers = 0; handle... |
94b4b84a-d657-4d7d-a17c-21aff11e6380 | 8 | @FXML
void initialize() {
ToggleGroup group = new ToggleGroup();
optToday.setToggleGroup(group);
optTomorrow.setToggleGroup(group);
lstDays.setItems(FXCollections.observableArrayList(
arrayBundle.getString("days_array").split(",")));
EventModel eventModel = ... |
fb8e1083-2863-4810-a815-22ab24bc8be5 | 6 | public String status(Integer denomination) {
CashMachineSystem cash = (CashMachineSystem) cashSystem;
switch (denomination) {
case 100:
return "$100 - " + cash.getQuantityOfValue(0);
case 50:
return "$50 - " + cash.getQuantityOfValue(1);
case 20:
return "$20 - " + cash.getQuantityOfValue(2);
case ... |
87e26dcb-3cee-4a56-9ebf-494899aa8d90 | 6 | public static void updateNonStructuralModuleOptions(Module oldmodule, Module newmodule, String newoptions) {
if (newoptions == null) {
newoptions = newmodule.stringifiedOptions;
}
{ PropertyList self000 = PropertyList.newPropertyList();
self000.thePlist = ((Cons)(Stella.readSExpressionFromStrin... |
f944204b-0aa1-42ca-ad47-49a3c1521698 | 3 | public static void circle(double x, double y, double r) {
if (r < 0) {
throw new IllegalArgumentException("circle radius must be nonnegative");
}
double xs = scaleX(x);
double ys = scaleY(y);
double ws = factorX(2 * r);
double hs = factorY(2 * r);
if (... |
2b9f87f8-0129-4f8d-93bb-0b153a1af131 | 3 | @Override
public boolean equals(Object obj)
{
if (this == obj)
{
return true;
}
if (obj == null || this.getClass() != obj.getClass())
{
return false;
}
Stage other = (Stage) obj;
return new EqualsBuilder()
.append(this.name, other.name)
.append(this.description, other.description)
.is... |
e5c7f676-d13c-4eb8-936c-b2a8b45e8ea6 | 7 | public static Rule_dirImplements parse(ParserContext context)
{
context.push("dirImplements");
boolean parsed = true;
int s0 = context.index;
ArrayList<Rule> e0 = new ArrayList<Rule>();
Rule rule;
parsed = false;
if (!parsed)
{
{
ArrayList<Rule> e1 = new ArrayList<Rule>... |
91be63b6-696f-4cec-8b9e-9d6f730012fc | 9 | private void updateStatus() {
if (game == null) {
rollButton.setEnabled(false);
statusLabel.setText("Sign in");
rollLabel.setText("");
return;
}
rollButton.setEnabled(game.canRoll());
if (game.isGameOver()) {
statusLabel.setText("Game over!");
}
else if (game.canRol... |
57856247-093e-48cf-b20e-7e55a5cc6610 | 7 | private void checkScrollBar(AdjustmentEvent e)
{
JScrollBar scrollBar = (JScrollBar)e.getSource();
BoundedRangeModel listModel = scrollBar.getModel();
int value = listModel.getValue();
int extent = listModel.getExtent();
int maximum = listModel.getMaximum();
boolean valueChanged = previousValue != value;... |
c0762f7a-ab92-47b0-b637-213e8b973cae | 8 | public static void ConvertToLibSVM(String directory,
String outputDirectory) throws FileNotFoundException,IOException{
FileReader fr = new FileReader (directory);
BufferedReader br = new BufferedReader(fr);
FileWriter stream = new FileWriter(outputDirectory,false);
BufferedWriter bo = new BufferedWri... |
3442f844-6b15-4348-8190-d3ab7f65265d | 1 | public static void makeNextBlackMoves(){
Vector<Move> resultantMoveSeq = new Vector<Move>();
alphaBeta(Game.board, Player.black, 0, Integer.MIN_VALUE, Integer.MAX_VALUE, resultantMoveSeq);
//Apply the move to the game board.
for(Move m:resultantMoveSeq){
Game.board... |
40fd3055-9cd4-4cd6-a8f2-0449589e32c9 | 5 | private static void doCompare() throws MVDToolException
{
try
{
MVD mvd = loadMVD();
if ( version == 0 || with == 0 )
throw new MVDToolException(
"can't compare version="+version+" with version "+with );
Chunk[] chunks = mvd.compare( version, with, uniqueState );
if ( mvd.getEncoding().toUppe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.