method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
40866661-3ffe-4208-95dd-69deb8271a77 | 5 | public static ArrayList<Reservation> searchByMemberID(int memberID) {
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
ArrayList<Reservation> r... |
0cd3148a-1e22-4c54-aa4e-e9fe8ac86c4b | 3 | public int inserir(Editor e){
Connection conn = null;
PreparedStatement pstm = null;
int retorno = -1;
try{
conn = ConnectionFactory.getConnection();
pstm = conn.prepareStatement(INSERT, Statement.RETURN_GENERATED_KEYS);
pstm.setString(1, e.getNome());... |
93c670bc-4137-4ba5-90ee-bd9c19da7514 | 5 | public static DataSource defineDcSource(HashMap<String,List<String>> pDictionary) {
// Data source
String namespace = "http://purl.org/dc/elements/1.1/source";
String dcSourceString = pDictionary.get(namespace).get(0);
if (pDictionary.containsKey(namespace)) {
if (dcSourceString.equals("Entrez Gene")) ... |
81cc2896-f8e0-4845-905a-22f7f2810d4d | 7 | public void controlarMenuInicial() {
int opcao = controladorTela.controlarMenuInicial();
switch (opcao) {
case 1:
String nomeJogadores[] = new String[2];
nomeJogadores = controladorTela.controlarNovoJogo();
if ("ZEUS".equals(nomeJogadores[1])) ... |
6efd3584-104f-4355-8445-d7a164f012bc | 7 | public void processResponse(XBeeResponse response)
{
// treat only normal packets
if (response.getApiId() == ApiId.DM_RX_RESPONSE)
{
DMRxResponse rxResponse = (DMRxResponse) response;
int data[] = rxResponse.getData();
log.debug("Received RX packet, optio... |
eac91cd1-a49d-4f3c-9f84-6826f47c794e | 8 | public void update(GameContainer container, int delta) throws SlickException {
if (container.getInput().isKeyDown(Input.KEY_Q)) {
zoom += (delta * 0.01f);
if (zoom > 10) {
zoom = 10;
}
}
if (container.getInput().isKeyDown(Input.KEY_A)) {
... |
53eae0e4-43bd-4b90-b4cb-8d83737c99cc | 5 | private boolean closeAddressBook() {
if(isModified) {
//ask user if they want to save current address book
MessageBox box = new MessageBox(shell, SWT.ICON_WARNING | SWT.YES | SWT.NO | SWT.CANCEL);
box.setText(shell.getText());
box.setMessage(resAddressBook.getString("Close_save"));
int choice = box.open();... |
1de3276a-0974-4722-b1ee-c6ce93880d5c | 7 | public void click(int iD, int mode)
{
if(cSelect != null)
{
if(mode == 0)
{
if(buttonMap.get(iD) == null)
{
for(int i = 0; i < BCOUNT; i++)
{
if(buttonArray[i].getID() == iD)
... |
6fa93004-7980-4f7a-b64d-98002688a1cd | 4 | public ListNode mergeTwoLists(ListNode l1, ListNode l2) {
ListNode preHead = new ListNode(0);
ListNode p = preHead;
ListNode p1 = l1;
ListNode p2 = l2;
while (true) {
if (p1 == null) {
p.next = p2;
break;
}
if... |
771b4201-4824-4b4c-b469-356f809663f9 | 2 | private void loadVersionFile() {
// Load table version file
dbVersionFile = new File(plugin.getDataFolder(), "DBVERSION");
try {
if (!dbVersionFile.exists())
dbVersionFile.createNewFile();
dbVersionProp.load(new FileInputStream(dbVersionFile));
} catch (IOException e) {
xAuthLog.severe("Failed to ... |
3571c8f1-0fa1-492e-a0e5-2de6392c8461 | 3 | private void addNewFoodSprites() {
Collection<Food> foods = getFacade().getFood(getWorld());
if (foods != null) {
for (Food food : foods) {
FoodSprite sprite = getSpriteOfTypeFor(FoodSprite.class, food);
if (sprite == null) {
createFoodSprite(food);
}
}
}
} |
f27a4dd4-1b26-4d66-a099-7e83974363cd | 9 | public static String display(Object object)
{
if (object == null)
{
return null;
}
try
{
// Invoke toString if declared in the class. If not found, the NoSuchMethodException is caught and handled
object.getClass().getDeclaredMethod("toString");
retu... |
091e7e1b-8d4e-4b12-b23d-903f52405817 | 9 | @Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
this.setResponseStuff(response);
this.createSession(request, response);
String action= null;
if ((request.getParameter("action") != null))
{
action= (request.getParameter("acti... |
6b156d3d-7c10-4e40-865e-0901868a4481 | 7 | public boolean areMovesLeft()
{
boolean movesLeft = false;
for(int i = 1; i < height - 1 && !movesLeft; i++)
{
for(int j = 1; j < width - 1 && !movesLeft; j++)
{
int vertex = j + i * width;
for(int neighbor = gameBoard.first(vertex); neighbor < gameBoard.vcount() && !movesLeft; neighbor = gameBoard... |
59c4b595-c586-4a8d-b1d8-0871999dbb43 | 0 | public void setPoints(int points) {
this.points = points;
} |
4c478b37-2fb5-4a3f-97b2-e1d9c3a23f87 | 2 | public static void main(String args[]) {
Callme target = new Callme();
for(int i = 0; i<1000; i++){
new Caller(target, "Hello"+i);
}
Caller ob1 = new Caller(target, "Hello");
Caller ob2 = new Caller(target, "Synchronized");
Caller ob3 = new Caller(target, "World");
// wait for threads to end
try {
o... |
97320c08-6382-4a14-8206-3e2f34c5e919 | 9 | @Override
public void affectPhyStats(Physical host, PhyStats affectableStats)
{
if(processing)
return;
processing=true;
if(host instanceof Item)
{
myItem=(Item)host;
if((lastMOB instanceof MOB)
&&((myItem.owner()!=lastMOB)||(myItem.amDestroyed()))
&&(((MOB)lastMOB).location()!=null))
remov... |
b1f5c5e5-3a95-4b9d-8896-557cb39c646e | 5 | public boolean cantoVale4(){
boolean error = true;
int resp = 0;
while(error){
Scanner sc = new Scanner(System.in);
try{
System.out.print("\n1-Quiero -- 2-No Quiero \nRespuesta:");
resp = sc.nextInt();
if((resp<1)||(resp>2)){
System.out.println("\nError. El valor ingresado no corresponde ... |
aeb11c23-a5fe-481f-a694-4cdb5f1efc5c | 4 | private ArrayList<String> updateExp(
ArrayList<String> updateExp,
ArrayList<String> expToUpdate, String tokenToChange) {
ArrayList<String> newTermsIter = new ArrayList<String>();
String newExpStr = "";
String exp = expToUpdate.get(0);
String[] splitExp = exp.split("\\s+");
boolean done = false;
for ... |
24bac62a-9d73-4c81-aaad-8afe09f1f730 | 6 | private static <T> PartitionList<T> eparition(PartitionListElement<T> tail2) {
PartitionList<T> returner = new PartitionList<T>();
for(int i = 1; i <= tail2.size(); i++){
PartitionListItem<T> partition = OrderConstrainedPartitionList.partition(tail2, i);
returner.add(partition);
if(partition.size() > 1... |
4a04f3bf-9f35-4fe8-896d-842e0f7a78b5 | 2 | public boolean equals(Object o) {
if (o instanceof RangeType) {
RangeType type = (RangeType) o;
return topType.equals(type.topType)
&& bottomType.equals(type.bottomType);
}
return false;
} |
defefe50-027b-46b8-92ac-4061cff19c61 | 8 | protected static int do_escaped(PrintWriter out, char c) {
StringBuffer escape = new StringBuffer();
if (c <= 0xFF) {
escape.append(Integer.toOctalString(c));
while(escape.length() < 3) escape.insert(0, '0');
} else {
escape.append(Integer.toHexString(c));
while(escape.length() < 4) ... |
7b88b496-bb0e-4e65-b283-497f566f0cfa | 9 | @Override
public boolean execute(Player player, Map mainmap, String[] params) {
Prop prop = null;
if( (prop = player.haveProps(PropName.BOMB)) != null )
{
int offset = Integer.parseInt(params[1]);
if( Math.abs(offset) > 10 )
{
System.out.p... |
f4e629a3-67b1-412e-b4be-cc2be5f3a7c4 | 1 | public boolean InsertarCultivo(Cultivo p){
if (p!=null) {
cx.Insertar(p);
return true;
}else {
return false;
}
} |
89d1c6e6-0ec9-44e2-b552-8209e6173850 | 9 | public static void writeShape(final Shape shape,
final ObjectOutputStream stream)
throws IOException {
if (stream == null) {
throw new IllegalArgumentException("Null 'stream' argument.");
}
if (shape != null) {
stream.writeBoolea... |
e8b345b1-065c-4aff-8ed8-b72305e21ef4 | 8 | public void updatePanel() {
continueBtn.setText(Game.TURN_END_TEXT[g.getCurrentTurnPart()]);
int turnPartEnding = g.getCurrentTurnPart() - 1;
if (turnPartEnding == -1) {
List<Integer> ints = resources.getSelectedResources();
int oldPlayer = g.getCurrentPlayer() -1;
if (oldPlayer == -1) oldPlayer = ... |
0e800bef-53e4-4da3-bd90-6c9e8e788b7c | 8 | public boolean contains(double x, double y) {
if (currentMode == POINTS_AND_LINES || currentMode == LINES) {
double dataX = axes.boundsXtoDataX(x);
lineRect.setRect(x*xFactor-4, y*yFactor-4, 7, 7);
Point2D[] line = xySeries.getLineForXVal(dataX);
if (line==null || Double.isNaN(line[0].getY()) || ... |
8c17825a-89d2-4fd5-b5ad-842ebc0bff62 | 9 | public static double predictProbability(Model model, Feature[] x, double[] prob_estimates) throws IllegalArgumentException {
if (!model.isProbabilityModel()) {
StringBuilder sb = new StringBuilder("probability output is only supported for logistic regression");
sb.append(". This is curre... |
d72e620c-1b7f-4cc4-af70-e3a638c812bd | 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... |
99f2c737-1c30-4c51-a925-8b58c64d2daf | 6 | private void processIntervals() {
for (int i = 0; i < randomNumbers.size(); i++) {
float randomNumber = randomNumbers.get(i);
for (int j = 0; j < N; j++) {
if (randomNumber < intervals[j]) {
intervalValues[j]++;
break;
... |
31d11737-3a56-4569-84ba-6c4ea9704605 | 3 | public static Logger getLogger() {
if (LOGGER == null) {
LOGGER = Logger.getLogger(LOGGER_NAME);
final SimpleLayout layout = new SimpleLayout();
LOGGER.addAppender(new ConsoleAppender(layout));
final HTMLLayout layout2 = new HTMLLayout();
try {
... |
4e7141b9-6743-4c84-9d72-7aa11be5578a | 5 | @Override
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
// Get the Activity from the given row
Time time = times.get(rowIndex);
// Change the field of Activity given by rowIndex, setting aValue.
if (columnIndex == columnNames.indexOf(ACTIVITY_COLUMN)... |
d1259467-94ca-4504-8fe3-908df7d13845 | 4 | private String getExcept(String strParam1, String strParam2) {
String resultado = "";
for (Map.Entry<String, String> entry : this.parameters.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
if (!value.equalsIgnoreCase("")) {
... |
d8b31293-a380-4b87-a742-feba6c4c37d1 | 3 | public Weapon generateWeapon(String input) {
if (input.equals("r")) {
super.setWeapon(Weapon.ROCK);
}
if (input.equals("p")) {
super.setWeapon(Weapon.PAPER);
}
if (input.equals("s")) {
super.setWeapon(Weapon.SCISSORS);
}
return ... |
0550f5aa-b549-4940-b59b-3bd972aaa29b | 3 | private void quicksort(int[] source, int left, int right) {
if (right - left <= 1)
return;
int pivot = source[left];
int i = left + 1;//cause 1 is a pivot. Otherwise this should be changed.
for (int j = left + 1; j < right; j++) {
if (pivot > source[j]) {
... |
1482164c-7e51-41ca-9466-45bd150d2cb0 | 0 | private static void input() throws FileNotFoundException, IOException {
InputStream is = new FileInputStream("/tmp/file.txt");
int available = is.available();
byte[] buf = new byte[available];
is.read(buf);
String str = new String(buf);
System.out.println(str);
is.close();
} |
5619e54d-8502-4076-badf-66c36416717f | 5 | public void GUI()
{
setUndecorated(true);
setSize(width, height);
setTitle(Read.getTextwith("installer", "name"));
setLocationRelativeTo(null);
setResizable(false);
setIconImage(new ImageIcon(this.getClass().getResource("src/icon.png")).getImage());
//Mouse postion changer
final Point point ... |
90eb8d52-1dd1-4805-8e5f-2d07e8d96f0e | 7 | private void altaCuenta (){
DefaultMutableTreeNode node = (DefaultMutableTreeNode) JTreeConta.getLastSelectedPathComponent();
Cuenta loadcuenta = null;
if (node == null){
mensajeError("Primero debe seleccionar una Cuenta.");
}
else{
Object nodeInfo = node... |
14c3d0fc-178f-4886-8c27-0f9229462c82 | 2 | private static BufferedImage imageOfString(int width, int height,
String imageStr) throws IOException {
BufferedImage image = new BufferedImage(width, height,
BufferedImage.TYPE_INT_RGB);
InputStream strStream = new ByteArrayInputStream(imageStr.getBytes());
byte[] bytes = new byte[2];
for (int y = 0; y ... |
dea4dc7a-790e-4f2b-bc29-d660cc11419a | 4 | public Personaje() {
try {
//Inicialización de los atributos
posicionActual = new Point3f(0, 0, 0);
direccion = Direccion.adelante;
actualizarDireccion();
adelante = atras = izquierda = derecha = adder = adizq = atder = atizq = andando = corriendo = at... |
038e173b-e584-422a-8d5e-93219d9a84e0 | 8 | public TradeDialog(Frame parent, final Landscape landscape) {
super(parent, true);
newdialog = this;
this.landscape = landscape;
setBounds(100, 100, 450, 300);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderL... |
fa62572c-f3b1-4b7d-8624-d02629daba73 | 7 | public void setOptions(String[] options) throws Exception {
//Debug Option
debug = Utils.getFlag('D', options);
// Set Tolerance.
String Tol = Utils.getOption("Tl", options);
if (Tol.length() != 0) {
Tolerance = Double.parseDouble(Tol);
}
//Set Threshold
String Thres = Utils.get... |
2a97fb33-f8ff-4648-b846-c6fc5d97f57a | 7 | public void destroy() {
if (editor != null) {
editor.getPage().removePageListener(this);
editor.removeEditorListener(this);
editor.destroy();
}
windowList.remove(this);
requestStopListening();
if (!windowList.isEmpty()) {
Modeler m = windowList.get(0);
if (!m.listeningToSocket) {
m.listen... |
31568576-b519-420f-9c55-146eb4a9a849 | 2 | public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
getStageManager().setStatge(StageManager.STAGE_MENUE, null);
} else if (e.getKeyCode() == KeyEvent.VK_R) {
getStageManager().setStatge(StageManager.STAGE_LEVEL, null);
} else {
player.keyPressed(e);
}
} |
0ee2e872-6011-428b-bf5a-31df4f5a3925 | 5 | public Program anneal(){
int cycles = 1; Random randomizer = new Random();
while(temperature > minTemperature){
Program clone = program.clone();
int selectedReaction = randomizer.nextInt(program.getReactionNo());
int sign = 0;
Double newKineticRate =randomizer.nextDouble() + sign;
clone.getReacti... |
517a8357-a785-43c9-aaaf-8144afc78888 | 8 | public static void main(String[] args) {
int minTO = 500;
int maxTO = 1500;
int timeoutCnt = 1000;
int removalCnt = timeoutCnt / 5;
boolean sleep = false;
long sleepTime = 50;
ArrayList<Timeout> timeouts = new ArrayList<>(timeoutCnt);
Random r = new Random... |
ca36a19c-b759-48db-b0bf-0bb9da85ae3f | 8 | public static final Map<String, List<String>> getMultiLists(String filename)
{
final Hashtable<String,List<String>> oldH=new Hashtable<String,List<String>>();
List<String> V=new Vector<String>();
try
{
String prefix="";
if(filename.startsWith("::")||filename.startsWith("//"))
{
prefix=filename.sub... |
6f257b4b-9c25-42b8-b67f-c3be9afcff43 | 3 | private final void login() throws FatalError {
try {
Output.printClockLn("Login (" + Config.getUserName() + ")", 1);
// create post data
HttpPost httppost = new HttpPost(Config.getHost()
+ "signups/login/");
List<NameValuePair> nvps = new ArrayList<NameValuePair>();
nvps.add(new BasicNameValueP... |
68929792-906c-43d4-9bb3-ab579a7e991e | 2 | public pgrid.service.corba.PeerReference getInfo ()
{
org.omg.CORBA.portable.InputStream $in = null;
try {
org.omg.CORBA.portable.OutputStream $out = _request ("getInfo", true);
$in = _invoke ($out);
pgrid.service.corba.PeerReference $result = pg... |
e7051eb6-a81e-45e8-a248-5dd6a670fd8c | 5 | public void pasteAlphaRect(CPColorBmp bmp, CPRect srcRect, int x, int y) {
CPRect srcRectCpy = (CPRect) srcRect.clone(), dstRect = new CPRect(x, y, 0, 0);
getSize().clipSourceDest(srcRectCpy, dstRect);
int[] srcData = bmp.data;
for (int j = 0; j < dstRect.bottom - dstRect.top; j++) {
int srcOffset = srcRect... |
ddf9c3e7-4799-4d4f-9dde-850c384271eb | 7 | @Override
public boolean equals(Object obj) {
if(obj == null) return false;
if(!(obj instanceof Point<?>)) return false;
Point<?> another = (Point<?>)obj;
return getX() == another.getX() && getY() == another.getY() && getZ() == another.getZ();
} |
c1e62108-5d2d-4560-a187-752c7b94e56a | 8 | public static void validate(String fieldName, String fieldValue, TYPE... rules) throws Exception{
for (TYPE rule : rules) {
if (rule == TYPE.REQUIRE) {
if (fieldValue == null || fieldValue.trim().length() == 0) {
throw new Exception(MessageFormat.format(PropertiesUtil.getErrorText("fieldValidate.require.m... |
861d247f-a7f8-4118-8275-474080caa3b1 | 3 | public static boolean checkPlayerDat(Player p) {
String pName = p.getName();
File pathDir = new File(path + "userData/" + pName + "/");
if(!pathDir.exists()) {
pathDir.mkdirs();
}
File mainDat = new File(path + "userData/" + pName + ".dat");
if(!mainDat.exists()) {
try {
mainDat.createNewFile();
... |
a4f9928e-e722-4655-abfc-cfab62b8d4f3 | 2 | public Node (int x, int y, Pathfind map, boolean walkable){
this.x = x;
this.y = y;
this.map = map;
this.walkable = walkable;
if (x == map.endX && y == map.endY){
return;}
} |
6ac0fcc1-ef9b-48b5-b7e3-96397c5b2f9f | 2 | private void rawHelper() {
/* We have received a message from the owner */
//TODO Make the below string a variable that is mutable to be set by the XML configuration file
if (jRobo.getFirst().startsWith(":BullShark!debian-tor@gateway/tor-sasl/nanomachine")) {
connection.sendln("PRIVMSG " + config.getC... |
fc077fc2-8684-48bd-ab19-7812d3f6574e | 0 | public void setId(Long id) {
this.id = id;
} |
54f9eac3-044d-44d8-8df4-84b4f49f8036 | 5 | private final String getChunk(String s, int slength, int marker)
{
StringBuilder chunk = new StringBuilder();
char c = s.charAt(marker);
chunk.append(c);
marker++;
if (isDigit(c))
{
while (marker < slength)
{
c = s.charAt(marker... |
67957ecc-c6ca-492f-bec5-9ba27063b1df | 9 | public String minWindow(String S, String T) {
Map<Character, Integer> need = new HashMap<>();
for (int i = 0; i < T.length(); i++) {
char c = T.charAt(i);
if (need.containsKey(c)) {
need.put(c, need.get(c) + 1);
} else {
need.put(c, 1);
}
}
int l = 0, r = 0, min = S.length() + 1, start = 0;
... |
8bdfc564-756b-453c-86c0-2c4b67533a95 | 8 | @Override
public void copySources(HashMap<String, Source> srcMap) {
if (srcMap == null) {
return;
}
Set<String> keys = srcMap.keySet();
Iterator<String> iter = keys.iterator();
String sourcename;
Source source;
// Make sure the buffer map exists:
... |
8af7ff6d-d3db-43aa-9cd2-64d200375c88 | 4 | boolean inSameSubroutine(final Label block) {
if ((status & VISITED) == 0 || (block.status & VISITED) == 0) {
return false;
}
for (int i = 0; i < srcAndRefPositions.length; ++i) {
if ((srcAndRefPositions[i] & block.srcAndRefPositions[i]) != 0) {
return tru... |
483bf543-b954-448d-bca6-2020158ab9cf | 7 | @Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
super.executeMsg(myHost,msg);
if((affected!=null)
&&(affected instanceof MOB)
&&(msg.amISource((MOB)affected)||msg.amISource(((MOB)affected).amFollowing())||(msg.source()==invoker()))
&&(msg.sourceMinor()==CMMsg.TYP_QUIT))
{
... |
4c476cd5-2938-4f5b-9a40-142109df2786 | 9 | private Object readValue() throws JSONException {
switch (read(2)) {
case 0:
return new Integer(read(!bit() ? 4 : !bit() ? 7 : 14));
case 1:
byte[] bytes = new byte[256];
int length = 0;
while (true) {
int c = read(4);
... |
78174124-9f7b-4f8f-9f03-03a1fa68faa1 | 8 | public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
for (int t = 0; t < T; t++) {
int n = sc.nextInt();
int[] arr = new int[n];
int total = 0;
for (int i = 0; i < n; i++) {
arr[i] = sc... |
72717a61-a054-4f65-9a89-2f9df856eccb | 2 | public static Request to(String resource, Object... args) {
if (args != null &&
args.length > 0) {
resource = String.format(resource, args);
}
return new Request(resource);
} |
0003f8e3-6766-4650-b1a5-552e2f9e9b34 | 9 | private void checkFormat() throws IllegalArgumentException {
if (!format.startsWith("%")) {
throw new IllegalArgumentException("Number format not starting with %");
}
if (!format.endsWith("m")) {
throw new IllegalArgumentException("Sexagesimal format not recognized (not ending m)");
}
... |
9bb807d8-ab2c-407f-8e92-4c37f9575b00 | 8 | final public void Println() throws ParseException {
/*@bgen(jjtree) Println */
ASTPrintln jjtn000 = new ASTPrintln(JJTPRINTLN);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));
try {
jj_consume_token(PRINTLN);
jj_consume_token(LPAREN);
Expressi... |
a50f2c3a-3724-424d-9b3b-1cd8de84c865 | 2 | public boolean isPalindrome(String s){
int length = s.length();
for(int i = 0 ; i < length/2 ;i++){
if(s.charAt(i) != s.charAt(length-1-i))
return false;
}
return true;
} |
bd54e093-0be2-42ef-8549-1fa677f09eae | 7 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if(tickID==Tickable.TICKID_MOB)
{
if((affected!=null)
&&(affected instanceof MOB)
&&(invoker!=null))
{
final MOB mob=(MOB)affected;
if(((mob.amFollowing()==null)
||(mob.amDead())
||(mob.location()!=invoker.location())))
... |
688faa94-3967-4886-9e88-06a7d64aac1d | 1 | public static String reverseString(String s) {
char c[] = s.toCharArray();
char c1[] = new char[s.length()];
for (int i = 0; i < c.length; i++) {
c1[i] = c[c.length - (i + 1)];
}
String s1 = new String(c1);
return s1;
} |
8fbd7a6f-0dac-4995-aa79-faac87367d9e | 8 | boolean parseMarkupDecl()
throws XMLMiddlewareException, MalformedURLException, IOException, EOFException
{
String name;
// This function returns true if it finds a markup declaration; false
// if it doesn't.
if (!isChar('<')) return false;
if (isString("!--"))
{
... |
d0185a32-f76f-452e-9beb-9ff7f479ad96 | 9 | public static void updateMap(int new_x, int new_y, char symbol)
{
int num_rows = 10; // The number of rows
int num_cols = 20; // The number of columns. Does not include the \n
int num_symbols = 4; // The number of symbols for Karel
int old_x = -1;
int old_y = -1;
cha... |
008af23b-600b-4230-b7c8-d1c5497b592e | 1 | public void ListSelection () {
_view.ls_products.setSelectionModel(new DefaultListSelectionModel() {
@Override
public void setSelectionInterval(int index0, int index1) {
if(_view.ls_products.isSelectedIndex(index0)) {
_view.ls_products.removeSelectionI... |
4bd2ac7c-47c5-4267-b806-e3e66ddf442b | 9 | public void write(int addr, int data){
//RAM
if (!mRamSelect)
{
mRAM[addr & 0x7F] = data;
}
else
{
switch (addr)
{
case Addresses.TIM1T:
mTimer = data;
mTISetUnderflow... |
dc69ed50-39ad-4134-a7af-7ba67675d97f | 9 | private List<String> formatHebrewSentences(List<String> sentences)
{
ArrayList<String> result = new ArrayList<String>();
int i = 0, j = 0,len;
for (String sentence : sentences)
{
len = sentence.length();
i = 0;
j = 1;
//connect letters
while (i < len)
{
while (j < len && sentence.charAt... |
efb13d91-e6b4-49b9-9b4a-9aa5172d3290 | 2 | public boolean existMessage(String id) {
for (int i=0; i < messages.size(); i++) {
if (messages.get(i).getId() == id) return true;
}
return false;
} |
92daf3a9-8fe6-46cc-81ff-bcf87993e8dc | 7 | @Override
public boolean onCommand(CommandSender sender, ItemStackRef itemStackRef, Command command, String label, String[] args) {
// Check the player is holding the item
ItemStack held = itemStackRef.get();
if (held == null || held.getTypeId() == 0) {
sender.sendMessage(plugin.... |
0cc4da86-f149-4efe-b0df-cb9e8065bf6d | 5 | public void removeDupilcates(String directory, String file) {
Set<String> uniqueLines = new LinkedHashSet<String>();
this.existsCreate(directory, file);
File input = new File(directory, file);
BufferedWriter writer;
BufferedReader reader;
String line;
try {
... |
bd9e9e7a-b2ac-4181-989e-d05f282c05ed | 1 | private boolean login (String username, String password) throws IOException{
user = JGroovex.authenticateUser(username, password);
if (!user.result.userID.equals("0")){
makeLoginMenu();
return true;
}else
return false;
} |
75c63d7e-fc9a-459e-a044-d6273148af03 | 1 | public BufferedImage createCompatibleImage(int w, int h,
int transparancy)
{
Window window = device.getFullScreenWindow();
if (window != null) {
GraphicsConfiguration gc =
window.getGraphicsConfiguration();
return gc.createCompatibleImage(w, h, transpa... |
c7f1d6fd-ab2a-43f6-9bd2-708ac33c5daf | 9 | public synchronized void checkPayments() throws BitcoinException {
Bitcoin.TransactionsSinceBlock t = monitorBlock == null ? bitcoin.listSinceBlock() : bitcoin.listSinceBlock(monitorBlock);
for (Bitcoin.Transaction transaction : t.transactions()) {
if ("receive".equals(transaction.category()... |
41e426af-9c2e-4d00-b1b0-65e95943ee80 | 4 | private static void generateTest(int length) {
int[] list = generateList(length);
System.out.println(length + " random numbers");
arrayToString(list);
System.out.print("Bechmark sort: ");
int[] sortedList = Arrays.copyOf(list, list.length);
long time = System.currentTimeMillis();
Arrays.sort(sortedList)... |
7b2e901c-cd4b-4807-802b-0ea053a7a7d2 | 2 | public TripsPreviewFrame(Frame parentWindow, final Printable pr, final PageFormat p, boolean formSheetAvailable) {
super(parentWindow, "Print Preview");
setModal(true);
this.formSheetAvailable = formSheetAvailable;
this.pg = new Pageable() {
@Override
public int getNumberOfPages() {
Graphics g = new ... |
584f082f-8a17-4ddb-afa3-029743836986 | 6 | public static void insertAndFetch() {
try {
Mongo mongo = new Mongo("localhost", 27017);
DB db = mongo.getDB("paldb");
// get a single collection
DBCollection collection = db.getCollection("users");
// BasicDBObject -example 1
logger.debug("BasicDBObject example...");
BasicDBObject document =... |
7e481610-adb8-4134-b32c-d1150ab3c69d | 9 | public void testRandomQueries() throws Exception {
final Random rnd = newRandom();
String field="data";
String[] vals = {"1","2","3","4","5","6","A","Z","B","Y","Z","X","foo"};
int maxLev=4;
// callback object to set a random setMinimumNumberShouldMatch
TestBoolean2.Callback minNrC... |
713740a6-9a2b-4aad-b3e2-3467f4d019c9 | 8 | public static void main(String[] args) throws IOException, ParseException {
Options opt = new Options();
opt.addOption("", "db", true, "The File used for Training");
opt.addOption("", "method", true, "The method used for Training");
opt.addOption("", "model", true, "The model file to be created");
Comman... |
225959fd-38cd-4015-8da6-c23b9b6278c8 | 3 | public boolean withinMarker(String marker) throws IOException {
if (mType == XMLNodeType.END_TAG) {
if (marker.equals(getMarker())) {
next();
return false;
}
} else if (mType == XMLNodeType.END_DOCUMENT) {
fail("expected: " + XMLNodeType.END_TAG.name() + "/" + marker.substring(marker.indexOf(':') +... |
cfbef7cb-8817-448c-b4d7-b363382a4441 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
TradeRoute other = (TradeRoute) obj;
if (ship == null) {
if (other.ship != null)
return false;
} else if (!ship.equals(other.ship))
r... |
b8f36387-f7a5-4488-a088-0d0e72e3ad23 | 2 | public void addMember(Instance instance) {
if (numOfMembers == 0) {
featureVector = new FeatureVector();
for (Entry<Integer, Double> entry : instance.getFeatureVector().getVector().entrySet()) {
featureVector.add(entry.getKey(), entry.getValue());
}
numOfMembers = 1;
}
else {
this.featureVec... |
11a6ac6d-1807-4de2-a6bc-6dfde3fac407 | 4 | @Override
public boolean equals(Object obj) {
if (!(obj instanceof Move)) {
return false;
}
Move move2 = (Move) obj;
return (this._col0 == move2._col0) && (this._col1 == move2._col1)
&& (this._row0 == move2._row0) && (this._row1 == move2._row1);
} |
351b54f6-366e-453b-97cb-71a4ecca9ab3 | 5 | @SuppressWarnings("unchecked")
public static void load() {
PluginVars.hard_mode = PluginVars.config.getBoolean("hard_mode", false);
PluginVars.allow_commu_fusion = PluginVars.config.getBoolean("allow_commu_fusion", true);
PluginVars.monster_effects = PluginVars.config.getBoolean("monster_effects", false);
Plug... |
2566d5be-b0a0-468c-9450-e45aee42fd19 | 2 | public PlanBoese(JSONObject help, String name) throws FatalError {
super(name);
options = new AngriffOptions(help);
try {
this.moneyAgain = help.getInt("nochmal");
} catch (JSONException r) {
}
try {
this.random = help.getBoolean("Zufall");
} catch (JSONException r) {
}
// GET /fights/enemys... |
c72ae672-9df7-4b6d-9605-9de2b4cc5041 | 9 | private Object buildValue()
{
Class cl = Kit.classOrNull(className);
if (cl != null) {
try {
Object value = ScriptableObject.buildClassCtor(scope, cl,
sealed, false);
if (value == null) {
... |
ab38b4e5-9acb-4a4a-b80b-489444de6c3f | 0 | public ArrayReverseIterable(T[] source)
{
this._source = source;
} |
a2cca144-eff7-4606-af9c-09f278da5096 | 0 | private void addDecoder(Encoder decoder) {
decoders.add(decoder);
} |
2955c004-2bf4-46b1-8c2c-d46c5e759a34 | 5 | @Override
public List<PrintableHorizontalLineObject> transformBody(int lineHeight, int width, int margin, FontMetrics fontMetrics) {
/*
* Formatting variables
*/
int half = width/2;
width-=10; // small correction...
half-=5;
int[] tabs = new int[]{0, half, 3*width/5+10, 4*width/5+5, width-9};
int threeZer... |
7f36adf4-704e-43d8-a458-410667f5b81a | 1 | @Override
public String process(int value) {
String freq = frequencies.get(String.valueOf(value));
if (freq == null) {
freq = "0";
}
long freqLong = Long.valueOf(freq);
freqLong++;
frequencies.put(String.valueOf(value),String.valueOf(freqLong));
// ... |
9bab3265-2456-49ae-a5a8-fcb5bcb2c39b | 0 | public String toString() {
return super.toString() + ": " + getUnprocessedInput();
} |
502d5970-b2a5-48cc-9745-b546cb12a7ad | 2 | private void handleTextField(JTextField field) {
if (field.getText().length() == 2) {
field.setText(field.getText() + ":");
} else if (field.getText().length() > 5) {
field.setText(field.getText().substring(0, 5));
}
} |
3468dd8d-cd01-47f7-a281-445f30750805 | 0 | public void addAll(List<CsvValue> values) {
this.lines.addAll(values);
} |
06f83417-d75d-4f77-ac97-c96f7db7bb18 | 4 | public static String getStringFromInputStream(InputStream iss) {
BufferedReader br = null;
StringBuilder sb = new StringBuilder();
String line;
try {
br = new BufferedReader(new InputStreamReader(iss));
while ((line = br.readLine()) != null) {
s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.