method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
5f5035ff-6a79-43c4-864c-3129318db9af | 7 | public static boolean exist(char[][] board, String word) {
if (null == word || 0 == word.length()) return true;
if (null == board || 0 == board.length) return false;
int r = board.length;
int c = board[0].length;
boolean[][] used = new boolean[r][c];
for (int i = 0; i < r; i++) {
... |
cc72d300-58ae-463f-96d8-56305d665054 | 4 | private boolean isKeyCurrent()
{
return ( nNode>0 && sRecno>0 && nKey>=0 && sRecno==recno && pgR[nKey] == recno);
} |
39e2f7cc-f094-468c-8ef0-541e6ae2e2b8 | 6 | public String nextCDATA() throws JSONException {
char c;
int i;
StringBuffer sb = new StringBuffer();
for (;;) {
c = next();
if (end()) {
throw syntaxError("Unclosed CDATA");
}
sb.append(c);
i = ... |
634febac-f805-414a-96e4-8083c0eec993 | 6 | public static void main(String[] args) {
if (args.length > 0) {
Sign.main(args);
return;
}
inReader = new Scanner(System.in);
boolean running = true;
while (running) {
switch (getChoice("What do you want to do today?",
" (1) Create a key pair\n" + " (2) Sign a graph\n"
+ " (3) Verify ... |
c7858717-76f5-434d-baee-f3bdc5531aa0 | 5 | public void keyPressed(KeyEvent e)
{
int key = e.getKeyCode();
if (key == KeyEvent.VK_SPACE)
{
fire();
}
if (key == KeyEvent.VK_A)
{
dx = -1;
}
if (key == KeyEvent.VK_D)
{
dx = 1;
}
if ... |
3f38fb5a-937a-48d5-8b20-d4f6ed070d30 | 2 | public ArrayList<ArrayList<Integer>> getPermute(ArrayList<Integer> numsToUse) {
ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>();
if (numsToUse.size() == 0)
return result;
if (numsToUse.size() == 1) {
result.add(numsToUse);
return result;
}
return result;
} |
04175def-2ecd-411c-a0c9-c836d73ae461 | 0 | @Override
public void mouseClicked(MouseEvent e) {
} |
39b15a27-f02e-495e-926e-f8c453f8c386 | 5 | public void test_01() {
// Show masks (just to check they are OK)
for (byte m : GenotypeVector.mask)
System.out.println("Mask :" + m + "\t" + Integer.toBinaryString(m & 0xff));
for (byte m : GenotypeVector.reverseMask)
System.out.println("Reverse Mask :" + m + "\t" + Integer.toBinaryString(m & 0x... |
648d6cb2-2916-4b6e-9d7a-456fc0889335 | 5 | @Override
public void keyPressed(KeyEvent e) {
LOGGER.info("KeyEvent " + e.toString());
switch (e.getKeyCode()) {
case KeyEvent.VK_RIGHT:
cliente.teclado(Comando.DIREITA);
break;
case KeyEvent.VK_LEFT:
cliente.teclado(Comando.ESQUERDA);
break;
case KeyEvent.VK_DOWN:
cliente.teclado(Comando.ABA... |
4007a660-2c59-4990-ab71-bb528f902891 | 3 | @Override
public Class getColumnClass(int column) {
Class returnValue;
if ((column >= 0) && (column < getColumnCount())) {
if(getValueAt(0, column)==null)
return String.class;
returnValue = getValueAt(0, column).getClass();
... |
ff70d77f-37c3-4be0-b1fa-cc550ae8c8e1 | 4 | private static int sLookup( String s, String[] sarr )
{
if( (sarr != null) && (s != null) )
{
for( int i = 0; i < sarr.length; i++ )
{
if( s.equals( sarr[i] ) )
{
return i;
}
}
}
return -1;
} |
043661d1-669d-44fc-ba9e-4aa7ff5365f9 | 4 | private void setColumnMinMax(Integer num, Date o) {
if (colMinDates.get(num)==null || colMinDates.get(num).after(o)){
colMinDates.put(num,o);
}
if (colMaxDates.get(num)==null || colMaxDates.get(num).before(o)){
colMaxDates.put(num,o);
}
} |
2c302e7f-42f8-4ccb-b31b-5fb0247f9dd2 | 8 | public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException {
// Parse command line
final Configuration conf = new Configuration();
final String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs();
CmdArguments cmdArgs = CmdArguments.instantiate(othe... |
ce5417e0-2e68-4a1c-a6fc-cd8145cc076f | 0 | public ListIterator GetPassangerIterator()
{
//get the listing of passengers
return passengers.listIterator();
} |
69c3f71b-ef41-43e7-8312-1a20e31b8243 | 5 | @Override
public String getColumnName(int column) {
switch (column) {
case 0:
return "Artikel";
case 1:
return "BTW";
case 2:
return "Hoeveelheid";
case 3:
return "Prijs";
case 4:
... |
8bc78690-ea90-474e-8aa8-0883f0089fb8 | 0 | public int getAge() {
return age;
} |
3c3627c5-7ec4-4213-8aad-641daf9f68d9 | 5 | void siirraMuodostelma(Muodostelma muod, int x) {
int pivotX = muod.getPivot().getX();
if (x < pivotX) {
while (x < pivotX) {
int temp = pivotX;
muod.siirra(-1);
pivotX = muod.getPivot().getX();
if (pivotX == temp) {
... |
c3bc0481-2494-4f38-9c1b-cf3e93d331ef | 5 | public DnDReferendumResult(List<Vote> votes) {
winners = new ArrayList<Option>();
int yesVotesNumber = 0;
int noVotesNumber = 0;
for (Vote vote : votes) {
DnDYesNoVote yesNoVote = (DnDYesNoVote) vote;
DnDYesNoOption yesNoChoice = yesNoVote.getYesNoChoice();
if (yesNoChoice.getValue() == false)
noVo... |
b8fcba36-2199-4e2c-9984-bd307f750221 | 4 | public void actionPerformed(ActionEvent e)
{
if(e.getActionCommand().equals("Exit"))
{
JOptionPane.showMessageDialog(null, "Are you Sure you want to exit?");
System.exit(0);
}
else if(e.getActionCommand().equals("About"))
{
JOptionP... |
deb3f2f0-4084-4074-9ae7-2ac092c3e314 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Categories other = (Categories) obj;
if (catId != other.catId)
return false;
if (catName == null) {
if (other.catName != null)
return... |
34d9cc6a-432a-47c4-a53d-c52919838115 | 4 | public JSONWriter key(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null key.");
}
if (this.mode == 'k') {
try {
this.stack[this.top - 1].putOnce(string, Boolean.TRUE);
if (this.comma) {
... |
e4fe1d2b-2bc7-46a1-aff8-300f8cddbfc9 | 8 | private static HashMap<String, String> getParams(Node databases, String dbId) {
HashMap<String, String> params = new HashMap<String, String>();
try {
ConfigParser cp = ConfigParser.getParser(databases);
String id = "";
Element db = null;
if (dbId != null && !dbId.isEmpty()) {
id = dbId;
db = cp.... |
d9c23428-52fd-4f6b-9f37-969db788fe07 | 3 | public int puntaje(RespuestaAlumno respuesta)
{
Pregunta laPregunta = null;
int puntos = 0;
for (Pregunta pregunta: preguntas)
{
if (pregunta.numero==respuesta.numero){
laPregunta = pregunta;
}
}
if(respuestaCorrecta(respuesta.respuesta,laPregunta.tipoDePregunta)) {
puntos= laPreg... |
7f309035-fad4-4ea9-a279-320775029e06 | 5 | public boolean isAdminPlayer(Player p) {
parent.log.debug("Checking if " + p.getName() + " is a CB admin");
if ((parent.getConfigu().getBool(Config.Option.ServerOpIsAdmin))
&& (p.isOp())) {
parent.log.debug(p.getName()
+ " is a server operator, and serverOpIsAdmin is set");
return true;
}
if (ch... |
d0f44ec6-474f-4669-bcfd-893b35756463 | 2 | @Override
public void comment(char[] ch, int start, int length) {
String str=new String(ch);
if (str.indexOf("<!-------- вместо <body> вставятся ссылки на произведения! ------>")!=-1) {
bodyFlag=true;
}
if (str.indexOf("<!--------- Подножие -------------------------------... |
e9245db9-4345-428d-aa5c-6813397e5150 | 6 | private void readAttributes(ScanfReader scanReader,
AttributeData attr, HashMap<String, Color> colorList)
throws IOException {
String name = null;
while (!(name = scanReader.scanString()).equals("end")) {
AttributeData a;
double hr;
if (name.eq... |
9097d404-4df2-4e48-8d69-1df6660f41a6 | 2 | public boolean canAuthenticate(String authentication) throws IOException {
//Initiate byte array for incoming key;
byte[] bytes = new byte[88];
int byteCount = this.incoming.read(bytes);
//Check the connection to socket; false if connection is closed;
if(byteCount == -1) {
this.accepting = false;
}... |
e9db591f-c8f1-4a09-8ff4-e632aa7dd7e4 | 4 | public Piste Yhteys(Suunta suunta){
switch(suunta){
case Pohjoinen:
return Pohjoinen;
case Ita:
return Ita;
case Etela:
return Etela;
case Lansi:
return Lansi;
}
return null;... |
55f08dcf-4e56-4a0e-b237-2a769b70cbf0 | 9 | private LinkedList<Diff> diff_lineMode(String text1, String text2, long deadline)
{
// Scan the text on a line-by-line basis first.
LinesToCharsResult b = diff_linesToChars(text1, text2);
text1 = b.chars1;
text2 = b.chars2;
List<String> linearray = b.lineArray;
LinkedList<Diff> diffs = diff_main(text1, te... |
821006f4-4100-413c-ba1c-94d29394041b | 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 feel.
* For details see http://down... |
8da6f5e7-48fd-4584-ac65-5c38332ffd03 | 4 | @Override
public List<UBLEntry> fetch() throws UBLParseException, UBLFetchException {
String jsonString = getJSONString();
List<UBLEntry> entries = new ArrayList<UBLEntry>();
try {
Object rootNode = m_jsonParser.parse(jsonString);
if(!(rootNode instanceof JSONArray))... |
a9812c83-2065-4d53-9081-b506374d7e6f | 4 | private void changeDigits(int k, Number originalNumber) {
for (int i = 0; i < 9; i++) {
numbers[k] = new Number(numbers[k].changeNumber(i));
if (validator.validateAccountNumber()) {
String possibleAccountNumber = "";
for (int j = 0; j < 9; j++) {
if (j == 0) {
possibleAccountNumber = n... |
6f551595-5c5d-4ce0-9da4-ddae426eefb3 | 0 | private void hide() {
getMessageBox().hide();
} |
00c5d0bf-1293-49ca-99cc-b203e506ae04 | 6 | Color getTempColor() {
if (temp < 1200) {
int x = (int) (255 * (temp - 800) / 400);
if (x < 0) {
x = 0;
}
return new Color(x, 0, 0);
}
if (temp < 1700) {
int x = (int) (255 * (temp - 1200) / 500);
if (x < 0) ... |
a219bc14-a403-4e5b-ad41-a877a93d0c59 | 5 | public static void deleteFile(String fileName){
// deletion flag
boolean flag = true;
// Create an instance of File representing the named file
File file0 = new File(fileName);
// Check that the file exists
if(!file0.exists()){
System.out.println("Method de... |
fb1153fc-b557-4216-ae20-5d8271880d1d | 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 feel.
* For details see http://down... |
94ceaeb8-314b-4a61-bc46-d94ef343b554 | 8 | public static boolean interpret(Client sender, String[] args) {
if (args != null) {
String prefix = args[0];
if (sender.getClientLevel().equals(Client.ClientLevel.UNSIGNED))
if (!args[0].equalsIgnoreCase(ClientCodes.SET_USERNAME)) {
sender.sendMessage... |
53298aaf-ed38-4206-b25f-3e8a32059b35 | 9 | public void printSelf() {
System.out.printf( "Node value = %d\n" , getData() );
for ( int i = 0 ; i < adjacentNodes.size() ; i ++ ) {
try {
System.out.printf( "Adjacent Node[%d] = %d\n" , i , adjacentNodes.getData( i ) );
} catch ( OutOfBoundsException error ... |
852493a9-dc23-4c1b-b0f7-2e2d39de6f77 | 7 | public float priorityFor(Actor actor) {
if (isDowned(target)) return 0 ;
final boolean report = verbose && I.talkAbout == actor ;
if (target instanceof Actor) {
final Actor struck = (Actor) target ;
float lossCost = PARAMOUNT, winReward = priorityMod ;
if (begun()) lossCost = 0 ;... |
e4f7f270-6542-4610-afaa-8002b9d26277 | 7 | public static int getDistance (String s, String t)
{
if (s == null)
{
if (t == null)
return 0;
return t.length();
}
if (t == null)
return s.length();
if (s.equals(t))
return 0;
char[] sArray = s.... |
84caf6e8-98ad-475c-b899-60ba54f8960f | 9 | private List<List<String>> find(Set<String> dict, List<List<String>> frontLists){
List<List<String>> ansLists = new ArrayList<List<String>>();
for(List<String> frontList : frontLists){
String frontStr = frontList.get(frontList.size()-1);
if(checkValid(frontStr, endStr)){
List<String> tempList = new ArrayL... |
3f02d1b3-4ca6-4456-bebf-2b5005aacc87 | 6 | public static void copyFile(String sourcePath, String targetPath) {
// define files
File sourceFile = new File(sourcePath);
File targetFile = new File(targetPath);
// define stream
InputStream is = null;
OutputStream os = null;
int byteread = 0;
byte[] c... |
cc4bc683-d24d-4f32-92a8-1aa405916e39 | 7 | public int get_info_barcode()
{
int return_val = -1;
int iprint_size = bang_HoaDon.getRowCount();
if(iprint_size>0)
{
pre_paid();
normal_mode(false);
return_val = 0;
iprint_size = Paid_MaSP.size();
try
... |
fed96904-dfa4-4830-ba92-4308211bbb01 | 3 | private void download_cmd() {
@SuppressWarnings("resource")
Scanner sc = new Scanner(System.in);
System.out.println("Input the filename which you want to download in HDFS:");
String filename = sc.nextLine(); //ļ
String data = null;
try {
data = client.read(filename);
} catch (Exception e1) {
// TO... |
c9a0da12-42ef-4a9f-b27d-58cc1b694efc | 0 | public static AnalysatorFrames getFrames(){
return frames;
} |
1c2cf06c-b176-4a32-a274-0e51d4d5868d | 4 | private List<String> splitToList() {
List<String> split = new ArrayList<String>();
currChar = -1;
while (currChar < toSplit.length()-1) {
currChar++;
if (toSplit.charAt(currChar) == splitAbout)
return nextIteration(split);
else if (isEscapedValue(splitAbout) || isEscapedValue('\\')... |
a1de7072-7c21-4b3d-a026-4ed35810d308 | 1 | private void commitTime() {
Date date = getDate();
if (date != null) {
Date time = (Date) timeSpinner.getValue();
GregorianCalendar timeCalendar = new GregorianCalendar();
timeCalendar.setTime( time );
GregorianCalendar calendar = new GregorianCalendar()... |
b1f33f88-12dd-4a1a-9eda-2fabde8f4ab4 | 7 | protected int[] refineOwners(KDTreeNode node, Instances centers,
int[] candidates) throws Exception {
int[] owners = new int[candidates.length];
double minDistance = Double.POSITIVE_INFINITY;
int ownerIndex = -1;
Instance owner;
int numCand = candidates.length;
double[] distance = new dou... |
03979024-e279-4fca-a1e5-6c889ee54993 | 7 | public static boolean NTfuncDefList() throws IOException {
boolean success = true;
success = ErrorRecovery(NonTerminal.funcDefList);
switch (lookahead) {
case ID:
case INTEGER:
case REAL:
if (!NTfuncDef())
success = false;
if (!NTfuncDefList())
success = false;
if (success)
writetoF... |
e1bd974a-1589-4f1b-9566-91430a52e12c | 4 | public SizeField(int[] initialValue, int maxInputLength, Color bg, String fieldTitle, boolean showResetBtn) {
if ((initialValue == null) || (initialValue.length != 2)) {
throw new IllegalArgumentException();
}
this.numberLength = maxInputLength;
if (bg == null) {
... |
b6ffc925-3284-480f-9530-fe4843c74b6d | 2 | public int addToQueuePriority(String channel, String message, int source, int priority)
{
if (source == 0)
{
System.out.println(message);
return -1;
}
else
{
priority = Math.max(Math.min(priority, 5), 1) - 1; //Chose 5,1 - 1 because it is c... |
497a5206-98fe-437c-b614-da63e00ea44f | 1 | public void testWithStartMillis_long2() {
Interval test = new Interval(TEST_TIME1, TEST_TIME2);
try {
test.withStartMillis(TEST_TIME2 + 1);
fail();
} catch (IllegalArgumentException ex) {}
} |
02dd3ec1-37ae-43a6-ac76-8d18ac3159e0 | 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 AccessRequestRole)) {
return false;
}
AccessRequestRole other = (AccessRequestRole) object;
if ((this.id == nul... |
b1b35d06-6acb-4160-9651-3bad969d8941 | 4 | public final void run() throws RestartLater, FatalError {
printJump("(" + idOrName + ")");
if (!Utils.fightAvailable(15)) {
return;
}
Opponent opponent;
try {
opponent = Opponent.getById(idOrName);
} catch (NotFound e) {
try {
opponent = Opponent.getByName(idOrName);
} catch (NotFound g) {... |
1d01dff4-e08a-41b4-b559-34726afff999 | 6 | protected static Map<String, String> parse(String[] args) {
if (args.length % 2 != 0) {
throw new RuntimeException("[option error] incomplete number of parameters [key value]");
}
Map<String, String> options = new HashMap<>();
String key, value;
for (int i = 0; i < ar... |
767eeb7b-09b8-4269-8d8c-73612422e558 | 2 | public void buildInfoPanel(String text){
if(tableau != null){
tableau.setVisible(false);
tableau.getTableHeader().setVisible(false);
}
if(infoLabel == null) {
infoLabel = new JLabel();
mainPanel.add(infoLabel , BorderLayout.WEST);
}
infoLabel.setText(text);
infoLabel.setVisible(true);
... |
178429ea-5a28-462e-9321-96b9fdf7bcc9 | 3 | private void hideMenu() {
for (int i = 0; i < buttonList.size(); i++) {
if (i ==9) break;
buttonList.get(i).hide();
}
title.hideWithEffect();
interactButton.show();
if (isAndroid)
stick.show();
} |
32854ff7-5ee0-4e5b-a3b4-30eb822b9d37 | 0 | public PersonApplication getPersonApplication(int i){
return PersonApplications.get(i);
} |
e7cbfbad-e3b1-43af-840e-2185fc6dd99c | 6 | public double[][] FDCT()
{
double[][] uvResult = new double[8][8];
double _cu, _cv, _sum = 0;
for(int u=0; u<N; u++)
{
_cu = (u==0) ? Math.sqrt(1.0/this.N) : Math.sqrt(2.0/this.N);
for(int v=0; v<N; v++)
{
_cv= (v==0) ? Math.sqrt(1... |
7adccf59-e779-4457-8436-3b9fe365cfc9 | 1 | @Override
public V get(Object key) {
if (keys.indexOf(key) != -1)
return values.get(keys.indexOf(key));
return null;
} |
9dab93ef-e24b-46ed-aebd-3df12c73579e | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Setting<T> other = (Setting<T>) obj;
if (!Objects.equals(this.data, other.data)) {
return false;
}
if (!Objects.equals(this.title, other.title)) {
re... |
6815a011-6648-4cc0-8e4b-f713e41671d9 | 6 | public static void main(String[] args) {
// test deep copy
//Random rn = new Random();
List<Point> path = new ArrayList<>();
int size = 10;
for (int i = 0; i < size - 1; i++) {
path.add(new Point(i, 0, 0.0));
}
for (int i = 1; i < size - 1; i++) {
path.add(new Point(size - 1, i, 0.0));
}
... |
6b848bb2-b6e2-444d-97fc-3ead51b8f33f | 8 | private void tryToFall(World par1World, int par2, int par3, int par4)
{
if (canFallBelow(par1World, par2, par3 - 1, par4) && par3 >= 0)
{
byte var8 = 32;
if (!fallInstantly && par1World.checkChunksExist(par2 - var8, par3 - var8, par4 - var8, par2 + var8, par3 + var8, par4 + ... |
4a99ce7a-fe88-4b03-b934-ebd5f9af7702 | 4 | private static StatBase[] initUsableStats(StatBase[] var0, String var1, int var2, int var3, int var4) {
if (var0 == null) {
var0 = new StatBase[32000];
}
for (int var5 = var3; var5 < var4; ++var5) {
if (Item.itemsList[var5] != null) {
String var6 = StatCo... |
0c9f199e-d265-4a29-81df-7a3531f91098 | 9 | public static void main(String[] args) throws Exception
{
String source = "serial@/dev/ttyUSB" + args[0] + ":115200";
//String source = "serial@/tmp/sersock" + ":115200";
PhoenixSource phoenix;
if (source == null)
phoenix = BuildSource.makePhoenix(PrintStreamMessenger.err);
else
phoenix = Build... |
41de0e1e-75c5-477c-8fc4-db958c38b4bb | 7 | private final boolean cons(int i) {
switch (this.b[i]) {
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
return false;
case 'y':
return (i == 0) ? true : !cons(i - 1);
default:
return true;
}
} |
4db2b54c-c33e-41bc-8d0a-96b0aa8d6c29 | 8 | private void updateLocalPlayerMovement(Buffer stream) {
stream.initBitAccess();
int currentlyUpdating = stream.readBits(1);
if (currentlyUpdating == 0)
return;
int movementUpdateType = stream.readBits(2);
if (movementUpdateType == 0) {
playersObserved[playersObservedCount++] = LOCAL_PLAYER_ID;
return... |
5b30ae05-0a8a-4b13-96c4-649ea867c9bd | 0 | protected JComponent initTreePanel() {
return treePanel;
} |
3e86c37b-2c11-4d03-9b37-2566602f77ee | 0 | public long createRoomType(String nameType, int numOfGuest, double price) {
typeEntity = new TypeEntity();
typeEntity.create(nameType, numOfGuest, price);
rooms = new ArrayList<RoomEntity>();
return typeEntity.getId();
} |
41c330c5-5901-4908-8147-534c8d6a0c54 | 0 | @Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
int index = list.getSelectedIndex();
ClientContact client = clientContactCurrent.get(index);
String guestName = client.getName();
RequestChatHandler request = new RequestChatHandler(client.getPort(), client.getIP(), myU... |
ed3d0d8c-5054-49b0-a6c9-06941b546143 | 9 | private void zip() {
File curFile;
String curFilename;
ZipEntry curEntry;
FileInputStream curInput;
ZipOutputStream zipOutput = new ZipOutputStream(outFile);
while (filesIndex < filesToWrite.length && !suspending) {
curFilename = filesToWrite[filesIndex];
curFile = new File(curFilename);
//If th... |
96b7d085-9930-42a8-89a2-72f40ea85267 | 3 | public void insert(String name, String value)
{
for(DataCell a : row)
{
if(a.name.equals(name))
{
if(a.value.equals(""))
{
a.value = value;
} else {
ErrorDialog errorDialog = new ErrorDial... |
3d8b5c32-5daa-492f-90a5-e3cb23f5fec4 | 9 | @Override
public boolean execute(MOB mob, List<String> commands, int metaFlags)
throws java.io.IOException
{
Vector<String> origCmds=new XVector<String>(commands);
final Environmental shopkeeper=CMLib.english().parseShopkeeper(mob,commands,"Borrow how much from whom?");
if(shopkeeper==null)
return false;
... |
5fc361c2-0b66-4d00-82ad-8e4faf64ef90 | 4 | @Override
public boolean equals(Object obj) {
if (!(obj instanceof Point2D))
return false;
if (obj == this)
return true;
if ((((Point2D) obj).getX() == getX()) && ((Point2D) obj).getY() == getY()) {
return true;
}
return false;
} |
d3dbdd13-9ad7-4566-922f-79ad58b7523f | 3 | public static boolean gameCheck()
{
for(int x = 1; x < b.length; x++)
{
for(int y = 1; y < b[x].length; y++)
{
//if the board doesn't match
//the answer key return false
if(!(b[x][y] == ansCheck[x][y]))
{
return false;
}
}
}
//if it makes it through the game is complete
//r... |
399713e7-4e3b-4b3a-9aca-a8ee94174c8a | 0 | @Override
public void before(Method method, Object[] args, Object target)
throws Throwable {
log.debug("method starts:" + method);
} |
63c8f1c6-0bb0-44f6-ba17-ece92dce1477 | 3 | public static ArrayList<Compte> getAllCompte() {
Statement stat;
ArrayList<Compte> comptes = new ArrayList<>();
try {
stat = ConnexionDB.getConnection().createStatement();
stat.executeUpdate("use nemovelo");
ResultSet res = stat.executeQuery("select * from co... |
825ad6cf-91da-49df-b5d6-3c842e0d6b4f | 4 | public DownloadProgressMonitor(String name, URL url) {
this.name = name;
currentlyDownloading.setText("Currently Downloading: " + name);
JFrame frame = new JFrame("Downloading...");
frame.setContentPane(jPanel);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
fr... |
ba651965-de3e-45fd-89db-4912434c450d | 0 | public LRParsePane(GrammarEnvironment environment, Grammar grammar,
LRParseTable table) {
super(environment, grammar);
this.table = new LRParseTable(table) {
public boolean isCellEditable(int r, int c) {
return false;
}
};
initView();
} |
0a38400b-f6c2-4909-a5ae-1609c82bce54 | 7 | String checkSecurity(int iLevel, javax.servlet.http.HttpSession session, javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpServletRequest request){
try {
Object o1 = session.getAttribute("UserID");
Object o2 = session.getAttribute("UserRights");
boolean bRedirect = false;
... |
a35d219e-0f65-4a7d-b5c3-01fe0c65fbea | 1 | @Test
public void TallentaminenToimiiKunLisataanUusi(){
kirjoitaOikeanmuotoinenSyote();
tiedot.LueTiedotTiedostosta();
tiedot.lisaaUusiOpiskelu("opiskelu3", 30);
tiedot.tallennaTiedostoon();
String luettu = lukija.next();
while (lukija.hasNext()){
... |
c88a1159-79a8-44a1-9396-d365ade1af96 | 3 | public void setValue(Object value, int baris, int kolom){
Produk p = dataProduk.get(baris);
String isi = (String) value;
switch(kolom){
case 0: p.setSimbol(isi);break;
case 1: p.setName(isi);break;
case 2: p.setPrice(isi);break;
default: break;
}
fireTableCellUpdated(baris, kolom);
} |
42f9a04a-54a4-4f15-a0f3-f2083b86faf5 | 4 | public static void convert(String name, ArrayList<EntityXML> entities) {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
Document doc;
try {
DocumentBuilder builder = factory.newDocumentBuilder();
doc = builder.newDocument();
Element n = doc.createElement("entities");
doc.... |
8192e3b6-72c0-4f5f-9764-84791fc73614 | 4 | public boolean inherits(final CommandSender player) {
if (this.contains(player.getName())) return true;
// permissions must be explicitly set to true to avoid default ops getting access due to permission that doesn't exist
for (final String name : this.members)
if (player.isPermissi... |
c7614b56-41c0-4ac3-8302-c5495406e43b | 4 | public void buildManifest(File pAdditionalPropertiesFile, PrintWriter pDestination)
throws ExManifestBuilder, ExParser {
//Assert the config file exists
Collection<File> lConfigFileList = FileUtils.listFiles(
mBaseDirectory
, new RegexFileFilter(BUILDER_CONFIG_FILENAME_PREFIX + ".*" + BUIL... |
e2dbbb7d-5523-46bb-a90f-b3493ea6b8e7 | 5 | public void setSelected(boolean value){
this.isSelected = value;
if(isSelected){
this.setBorder(new MatteBorder(4,0,4,0,Color.CYAN));
for(int i = 0;i < pointersToRecolors.length;i++){
if(pointersToRecolors[i] != null){
pointersToRecolors[i].setBorder(new MatteBorder(4,0,4,0,Color... |
0160214c-49a3-449a-9b27-33d1e04dfe4a | 3 | public static int addScore(Score s, Statement stmt) throws Exception{
// 首先查找s对应学号的学生是否存在,如果不存在则返回-1
// 如果学生存在,再查找该学号是否已经录入成绩
// 如果已经录入成绩,则返回失败,否则在Score表中添加成绩
String sel_str = "select * from stu_info where stu_no = '" + s.stu_no + "'";
// // System.out.println(sel_str);
if( !stmt.executeQuery(sel_str).next(... |
089d221c-25d3-4a77-86e6-4e5fea2530c2 | 3 | static public void main(String[] args){
if( args.length < 1){
System.err.println("Please specify a remote hostname");
System.exit(-1);
}
if(args.length > 2) {
System.err.println("Warning: Extra arguments passed, ignoring");
}
String host = arg... |
e0bc9e1e-f8e7-4926-9f71-8cb8484ab65c | 8 | private void paintEdge(int edgeID, int replaceID) {
final Batch <Coord> toPaint = new Batch <Coord> () ;
for (Coord c : Visit.grid(0, 0, mapSize, mapSize, 1)) {
final int h = typeIndex[c.x][c.y] ;
if (h != edgeID) continue ;
boolean inside = true ;
for (int i : N_INDEX) {
try {
... |
f7a664d1-d3b7-425e-95c7-0c73b176f7f9 | 1 | @Override
public boolean accept(File file) {
return file.isDirectory() || file.getName().endsWith(".p7s");
} |
7b27fa60-7bbb-4c9f-b985-efdbeed7e091 | 5 | private void updateDeviceList() {
try {
final Process process = new ProcessBuilder("adb", "devices")
.redirectErrorStream(true).start();
Thread t = new Thread(new Runnable() {
@Override
public void run() {
ArrayList<Device> tempList = new ArrayList<>();
try (BufferedReader reader = new... |
622f9506-dbb1-4eb0-ace4-c3672e8a0ac4 | 0 | public int store(int offset) {
runStack.set(framePointers.peek() + offset, this.peek());
return this.pop();
} |
fa4b886d-a336-49c8-a993-c232e07d3a5c | 2 | public final void takeChildren(ChunkyObject o) {
// If a child is removed, parent reposesses all their objects.
// ex. If a child of a town is removed then their plots are owned by town.
HashMap<String, HashSet<ChunkyObject>> reposess = o.getOwnables();
o.ownables = new HashMap<String, ... |
b0464fa0-f4f6-4c34-b11d-9a8c25a3f607 | 0 | public void highlight(int row, int column) {
highlight(row, column, THRG);
} |
9781ac82-d2b0-445f-85e0-f8b987500e02 | 4 | public static void partialSort(Ant[] population, int number) {
for (int i = 0; i < number; i++) {
int best = i;
for (int j = i+1; j < population.length; j++) {
//see compareTO() method specification
if (population[best].compareTo(population[j]) == 1) {
best = j;
}
}
if (best != i) {
... |
b72c4c27-aba4-4af4-9dc1-df826dd07708 | 3 | @Override
protected void draw(Graphics2D g, float interpol,Vector offset) {
List<Vector> points = new ArrayList<Vector>(vertices);
float pointAngleInterval = tpi/vertices;
float pointAngle = angle + interpol*angleSpeed;
int radius = dims.width>>1;
Vector interpolPosition = Vector.add(Vector.add(position,o... |
681d51e0-e099-4d3c-829f-ea3ab08d71d1 | 4 | public static Categories parse(int code) {
switch (code) {
case 1:
return SHOES;
case 2:
return SHIRTS;
case 3:
return CAPS;
case 4:
return PANTS;
}
return null;
} |
9e4e04da-4079-41e9-8ed0-93706d41af4a | 2 | private TypeNode getExtendsNode(final Type type) {
final GraphNode node = extendsGraph.getNode(type);
if ((node == null) && type.isObject()) {
this.addClassNamed(type.className());
}
return ((TypeNode) extendsGraph.getNode(type));
} |
b08d0acf-bfac-493e-a343-d94729784e58 | 8 | public int[] fix34(int[] nums) {
for (int i = 0; i < nums.length; i++) {
if (nums[i] == 3) {
for (int j = i+1; j < nums.length; j++) {
if (nums[j] == 4) {
int temp = nums[i+1];
nums[i+1] = nums[j];
... |
556e9c13-91b6-4312-bb32-4d042444285d | 5 | public void addBlock( int x, int y, Block b ) {
int index = stackIndex(x,y);
Block[] stack = blockStacks[index];
if( stack == null || stack.length == 0 ) {
blockStacks[index] = b.stack;
return;
}
for( int j=0; j<stack.length; ++j ) {
if( stack[j] == b ) return;
}
Block[] newStack = new ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.