method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
680344f1-44bf-4879-82c9-85d47fda818b | 9 | public ChineseLine(int x1, int x2, int y1, int y2) {
this.x1 = x1;//sets the value of the first x coordinate in the line
this.x2 = x2;//sets the value of the second x coordinate in the line
this.y1 = y1;//sets the value of the first y coordinate in the line
this.y2 = y2;//sets the valu... |
25143036-0489-4dfb-b573-1a85c1251815 | 1 | public void doFixedLengthHeaderAndTrailer() {
try {
final String mapping = ConsoleMenu.getString("Mapping ", FixedLengthHeaderAndTrailer.getDefaultMapping());
final String data = ConsoleMenu.getString("Data ", FixedLengthHeaderAndTrailer.getDefaultDataFile());
FixedLengthHe... |
7b3b226d-328a-4d20-8b65-eb804032693b | 0 | public int getSize() {
return items.length;
} |
54b5d9ea-37b6-4d36-9e8a-84458f1b88fb | 4 | public static Class compile(final String className, final String classString) {
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<JavaFileObject>();
JavaFileManager fileManager = new ClassFileManager(compiler.... |
aee3d56c-aaf6-4812-9405-1490acf5abfa | 9 | public void chooseTrainAndTestSignatures(String database)
{
ArrayList<LabeledSignature> signatures = parseDatabaseFile(database);
if (database == null) return;
ArrayList<ArrayList<LabeledSignature>> userGenuineSignatures = new ArrayList<ArrayList<LabeledSignature>>(numberOfUsers);
ArrayList<ArrayList<LabeledS... |
e5073628-c988-4a39-aeb5-c49d8d771bae | 3 | @Override
public void setInstructionList(ArrayList<Instruction> instructions) {
this.instructions = instructions;
instructionList = new ArrayList<String>();
for (Instruction instruction : instructions) {
if (instruction != null && instruction.getName() != null) {
instructionList.add(instruction.getName())... |
f4f032ea-5ecc-4835-be11-e7491388508f | 5 | private void updateForDragOver(Point where) {
int count = getComponentCount();
int insertAt = count;
for (int i = 0; i < count; i++) {
Component child = getComponent(i);
if (child instanceof DockTab) {
Rectangle bounds = child.getBounds();
if (where.x < bounds.x + bounds.width / 2) {
insertAt =... |
6348581e-cc5f-4b35-bc50-9088bf6a7b25 | 1 | @Override
public final void write(final String text) throws OutputException {
FileWriter fileWriter = null;
BufferedWriter writer = null;
try {
fileWriter = new FileWriter(path, true);
writer = new BufferedWriter(fileWriter);
writer.append(text);
writer.newLine();
writer.close();... |
a2c90704-6567-4ec9-9a6e-fcb212167c6b | 5 | @SuppressWarnings({ "unchecked", "unused" })
@ApiMethod(name = "listMessages")
public CollectionResponse<MessageData> listMessages(
@Nullable @Named("cursor") String cursorString,
@Nullable @Named("limit") Integer limit) {
EntityManager mgr = null;
Cursor cursor = null;
List<MessageData> ... |
353f9211-5c34-4e47-bf53-d1f291639c3b | 6 | public A2Ifs() {
System.out.println("Enter the number of your birth month:");
// birthMonth = inputInt() - 1;
while ((birthMonth = inputInt()) > 12 || birthMonth < 1) {
System.out
.println("You must have forgotten your birthmonth, ask your mum then try again:");
}
birthMonth--;
System.out.println("... |
06be7e70-64bf-4aae-a091-1cc58b164c68 | 4 | private void printGridletList(GridletList list, String name,
boolean detail, double gridletLatencyTime[])
{
int size = list.size();
Gridlet gridlet = null;
String indent = " ";
StringBuffer buffer = new StringBuffer(1000);
buffer.append("\n\n==... |
ae40e600-c991-479d-b5a7-b7fb86aa870b | 3 | JarDirClassPath(String dirName) throws NotFoundException {
File[] files = new File(dirName).listFiles(new FilenameFilter() {
public boolean accept(File dir, String name) {
name = name.toLowerCase();
return name.endsWith(".jar") || name.endsWith(".zip");
}
... |
92bbe6a9-4987-4963-a18c-946ab5374146 | 0 | public ConfigurationReader() throws ReaderException {
_parseFile();
} |
a682044f-2d8b-4e49-ac69-6dd1477b6246 | 2 | public static void confirmExit (final JFrame fen){
fen.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
int reponse = JOptionPane.showConfirmDialog(fen,
"Voulez-allez quitter l'application, Voulez-vous enregistrer",
"Confirmation",
JOptionPane.YES_NO_OPTION,
... |
55f29b47-bab6-4f9b-b137-df8bf556810a | 0 | public Level(Game game, Tileset tileset) {
this.game = game;
this.tileset = tileset;
} |
d0604961-b5dc-42f0-9bbe-886dc7dfbcf8 | 4 | private void protectServer(int level, String[] keywords) {
if (isAccountTypeOf(level, ADMIN, MODERATOR)) {
if (keywords.length == 2) {
if (Functions.isNumeric(keywords[1])) {
Server s = getServer(Integer.parseInt(keywords[1]));
if (s.protected_server) {
s.protected_server = false;
sendMes... |
d5787f6e-5565-4da8-b26f-cc644f960f8b | 8 | public static void main( String[ ] args ) throws IOException {
BufferedReader in = new BufferedReader( new InputStreamReader( System.in ) );
String line = "";
StringBuilder out = new StringBuilder( );
int n = Integer.parseInt( in.readLine( ) );
for ( int p = 0; p < n; p++ ) {
int index = 0;
cube = new... |
3d817bec-3a1a-4bf5-9b17-ac94d1c895d5 | 9 | public static void main(String[] args) {
LinkedList filterList = new LinkedList();
IntegerFilter f = null;
int actualFilters = 0;
if (args.length == 0) {
System.err
.println("USAGE: java polimi.reds.examples.ClientTester [reds-tcp | reds-udp]:<brokerAddress>:<brokerPort>"
+ " <localPort> <publi... |
a79d60b2-50ce-466b-bf29-19bec3f47d38 | 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... |
55c19f14-5077-49c8-b1df-fe9b8fce4fae | 6 | public Creator() throws IOException {
BufferedReader reader = new BufferedReader(new FileReader("Kills.txt"));
String lol = null;
int i = 0;
while((lol = reader.readLine()) != null)
{
System.out.println(++i);
String name = lol.substring(1,lol.indexOf("]")... |
612aed3e-911f-4b0b-be2d-c3c9b0d1a63c | 3 | @Override
public JavaFileObject getJavaFileForInput(Location location,
String className, Kind kind) throws IOException {
JavaFileObject result;
if (StandardLocation.CLASS_OUTPUT == location && Kind.CLASS == kind) {
result = outputMap.get(className);
if (result == ... |
7cee43cd-3341-4058-958b-38944b04aca9 | 1 | public DNode getLast() throws IllegalStateException{
if(isEmpty()) throw new IllegalStateException("List is empty");
return trailer.getPrev();
} |
2079354f-208d-4949-9d55-46b39c55cdb7 | 1 | public void endTurn()
{
for (Unit unit : units) {
unit.endTurn();
}
} |
548b77a0-86b0-4a3f-a542-52021d05b0f3 | 0 | public String getName() {
return name;
} |
694aa80f-cda7-4601-9e94-beaf00a82891 | 0 | @Override
public synchronized void stop() throws Exception {
doStop();
} |
e5890e9c-9352-4c2c-b5c7-d0a1fb0dc0a0 | 9 | public void getTicketContents(String ticketId) {
data = new HashMap<String, String>();
try {
if(user != null && pass != null) {
Authenticator.setDefault(new TracAuthenticator());
}
URL url = new URL(prop.getProperty("trac_url") + combo.getSelectedItem() + "/ticket/" + ticketId... |
443e12e8-b31a-4d11-98e1-ab303e3de316 | 9 | public String listSocials(Session viewerS, List<String> commands)
{
WikiFlag wiki = getWikiFlagRemoved(commands);
final StringBuilder buf=new StringBuilder("^xAll Defined Socials: ^N\n\r");
final int COL_LEN=CMLib.lister().fixColWidth(18.0,viewerS);
int col=0;
Set<String> baseDone = new HashSet<String>();
... |
22815d77-cd8f-43ee-8f0b-2d832afdf038 | 0 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
answersGroup = new javax.swing.ButtonGroup();
mainPanel = new javax.swing.JPanel();
eventsPanel = new javax.swing.JPanel();
ev... |
6b0e00c0-efda-4586-8157-165e8abd5340 | 5 | public boolean canJump(int[] A) {
int[] minJump = new int[A.length];
Arrays.fill(minJump, Integer.MAX_VALUE);
minJump[0] = 0;
int currentMax = 0;
for (int i = 0; i < A.length; i++) {
if (minJump[i] == Integer.MAX_VALUE)
break;
for (int j =... |
1ff1c6ab-dbe0-4afc-83ab-9333b377a230 | 6 | @Override
public void actionPerformed(ActionEvent e) {
//System.out.println("SelectNoneAction");
OutlinerCellRendererImpl textArea = null;
boolean isIconFocused = true;
Component c = (Component) e.getSource();
if (c instanceof OutlineButton) {
textArea = ((OutlineButton) c).renderer;
} else if (c in... |
ba847b0e-a45a-4398-8409-6d8ff5c4bc45 | 4 | int getRoomFitness(RoomScheme r){
int roomFitness = maxFitness(r);
for (Subject[] room : r.rooms) {
for (Subject room1 : room) {
if (room1.getCode() == 0) roomFitness --;
if (classCount(r, room1.getCode()) > 2) roomFitness --;
}
} return ro... |
1d2ea7fb-f28b-4157-a13e-9a2b2a487745 | 2 | public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int length = in.nextInt();
int testCases = in.nextInt();
int[] laneWidth = new int[length];
for (int i = 0; i < length; i++) {
laneWidth[i] = in.nextInt();
}
while (testCases > 0) {
System.out.println(serLane(l... |
1fe6c196-b698-45b3-9889-5366e66831a5 | 9 | public static void newMap() {
Writer writer = null;
try {
writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(MazeMaker.mapName), "utf-8"));
for(int y = 0; y < MazeMaker.gridSize; y++) {
for(int x = 0; x < MazeMaker.gridSize; x++) {
if(MazeMaker.border == true && (y == 0 ||... |
f74c5d26-c69b-44b6-b2f7-4853d47404b9 | 3 | public Matrix4f initIdentity() {
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
int entry;
if (i == j) {
entry = 1;
} else {
entry = 0;
}
m[i][j] = entry;
}
}
return this;
} |
1d6f84f6-db40-4729-b850-b7130af72012 | 1 | private void notifyListeners()
{
for (PriceListener listener : listeners)
listener.onPriceChanged(price);
} |
4fc3cd4c-83a0-4b9b-bb8f-7677404aae85 | 6 | public SoundPlayer() {
try {
SoundSystemConfig.setCodec("ogg", CodecJOrbis.class);
} catch (SoundSystemException ex) {
oggPlaybackSupport = false;
}
try {
SoundSystemConfig.setCodec("wav", CodecWav.class);
} catch (SoundSystemException ex) {
wavPlaybackSupport = false;
}
boolean is... |
f3956e4b-c307-417e-9585-34377267f2bd | 5 | private static void simulateMove(Robot r, int x2, int y2) throws InterruptedException {
int x1 = MouseInfo.getPointerInfo().getLocation().x, y1 = MouseInfo.getPointerInfo().getLocation().y;
long starttime = System.currentTimeMillis();
while (Math.abs(x1 - x2) > 5 || Math.abs(y1 - y2) > 5) {
... |
d17e29c2-f3f5-4901-9cb5-038343c1fa2f | 1 | private int startY( Side side ){
if( side == Side.SOUTH ){
return boundaries.y + boundaries.height;
}
else{
return boundaries.y;
}
} |
76f5d57a-f9aa-46df-a56e-c94b1cf6f0ff | 1 | public static String stripTrailingBlanks(final String string) {
//// Preconditons
if (string == null)
throw new InvalidParameterException("string cannot be null");
return stripTrailing(string, ' ');
} |
478e0520-6674-4152-9a37-6776d5042d90 | 1 | protected void drawState(Graphics g, State state) {
statedrawer.drawState(g, getAutomaton(), state);
if (drawLabels) {
statedrawer.drawStateLabel(g, state, state.getPoint(),
StateDrawer.STATE_COLOR);
}
} |
b6d436ac-8edf-4a81-bcd4-32964bae3fb3 | 1 | private void processMoveFromHand(MouseEvent e) {
List<Card> hand = game.getHand().getList();
if (hand.size() > 0) {
final double handXGap = handXGap(hand.size());
int index = (int) ((e.getX() - handXStart()) / (handXGap + CARD_WIDTH));
activeMove = new CardMoveImpl(... |
33b158c6-1b5c-40ef-a48a-de6c18e5c08a | 7 | public void cleanNotWin(){
boolean win = false;
//Controllo se c'è una mossa che mi fa vincere
for(int i=0;i<desmosse.length;i++)
if(desmosse[i]!=null)
if(desmosse[i].isWinner()){
win = true;
break;
}
System.out.println("Variabile che controlla se ci sono vincite: "+win);
//Se c'... |
6c80c578-b7b9-482a-9943-8ab26bb470ef | 9 | public Behaviour jobFor(Actor actor) {
if ((! structure.intact()) || (! personnel.onShift(actor))) return null ;
final Choice choice = new Choice(actor) ;
//
// Return a hunting expedition. And... just explore the place. You'll
// want to make this a bit more nuanced later.
if (still != nul... |
0224d046-e38a-40a2-88d9-d465c1173a28 | 8 | public RelativeCombinedStream(final ArchiveDataStream[] streamsToCombine, ArchiveDataSpecification spec) {
// Siehe de.bsvrz.ars.ars.mgmt.tasks.ArchiveQueryTask.Query.maxInterval
long maxSize = Math.min(spec.getTimeSpec().getIntervalStart(), 16000);
// Erstmal alle Stream wie gewohnt verketten
ArchiveData... |
fcd9998d-ce1f-4019-baea-dcb0ce187757 | 1 | public void update() {
if (active){
vy+=Player.ACCELERATION/Level.speed();
vx=(float) Math.max(Math.min(12, vx), -12);
vy=Math.max(Math.min(7/Level.speed(), vy), -7/Level.speed());
vx*=Math.pow(.9,1/Level.speed());
x+=vx;
y+=vy;
}
} |
542688dd-cf9c-490c-a213-4e0f4fe72620 | 4 | private Declaration declaration() throws RequiredTokenException
{
enterRule(NonTerminal.DECLARATION);
Declaration declaration = null;
try
{
if(firstSetSatisfied(NonTerminal.VARIABLE_DECLARATION))
declaration = variable_declaration();
else if(firstSetSatisfied(NonTerminal.ARRAY_DECLARATION))
decl... |
01d5ff66-9502-4b0a-a4d8-75954afcdb32 | 3 | public boolean isLastRow(boolean isWhite) {
return (isWhite && this.rank == '8') || (!isWhite && this.rank == '1');
} |
25dfe8d8-37a6-4537-be0f-99f18502545b | 1 | protected void fireChangedMostRecentDocumentTouchedEvent(Document doc) {
changedMostRecentDocumentTouchedEvent.setDocument(doc);
for (int i = 0, limit = documentRepositoryListeners.size(); i < limit; i++) {
((DocumentRepositoryListener) documentRepositoryListeners.get(i)).changedMostRecentDocumentTouched(changed... |
5f37894b-e610-4fd7-8dea-49a4dd5802ad | 0 | static void changeLevel(Tank t) {
t.level = 55;
} |
6392899e-15f3-46ef-b598-a429acce3619 | 7 | @SuppressWarnings({ "unchecked", "rawtypes" })
public RoomBooking() {
setBackground(UIManager.getColor("CheckBoxMenuItem.selectionBackground"));
setForeground(Color.WHITE);
setFont(new Font("Cordia New", Font.BOLD, 14));
setTitle("Conference Room Booking System");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOS... |
76fed4c0-6ce5-468d-9f66-32492768dd06 | 6 | @Override
public void run() {
//if(initConnection()) {
while(connected && !socket.isClosed()) { //read in commands
//TODO: try/catch for badly formatted commands
Command cmd = null;
try {
String inputStr = in.readLine();
if(inputStr == null) {
System.out.println("null input");
d... |
d854f1f5-10d5-407b-ad46-5461cad48199 | 0 | public static void main(String[] args) throws IOException, ClassNotFoundException {
System.out.println("Creating objects: ");
Blip3 b3 = new Blip3("String ", 47);
System.out.println(b3);
ObjectOutput out = new ObjectOutputStream(new FileOutputStream("Blip3.out"));
System.out.pri... |
010c75f5-845c-4006-8534-374067753d73 | 6 | @SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public Object instantiate( ObjectBinder context, Object value, Type targetType, Class targetClass )
{
if( value instanceof Map && targetClass == User.class )
{
Map<String, ?> map = (Map<String, ?>) value;
User u... |
7cf68c9d-0fb7-411b-9adf-ac49f15245fb | 1 | public double calculateOvershootCosts(AbstractStochasticLotSizingProblem problem, double[] periodOvershoot){
AbstractLotSizingPeriod[] periods = problem.getPeriods();
double overshoot = 0.0;
double costs = 0.0;
for (int i = 0; i < periodOvershoot.length; i++){
overshoot += periodOvershoot[i];
costs += per... |
4c509fbf-2e1b-4173-9ef6-6af88782540d | 0 | public void flush() throws IOException
{
target.flush();
} |
fce75b3a-2b64-47e9-a3ea-d88994c058bd | 9 | private void createDragOperations(Composite parent) {
parent.setLayout(new RowLayout(SWT.VERTICAL));
final Button moveButton = new Button(parent, SWT.CHECK);
moveButton.setText("DND.DROP_MOVE");
moveButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
Button b = (... |
ac22350d-a8af-42fa-ba8b-6caf79dd702c | 4 | public ArrayList stepConfiguration(Configuration config) {
ArrayList list = new ArrayList();
PDAConfiguration configuration = (PDAConfiguration) config;
/** get all information from configuration. */
String unprocessedInput = configuration.getUnprocessedInput();
String totalInput = configuration.getInput();
... |
3892f1f6-1473-4e87-9a4f-daeb64b885e6 | 3 | public static float pedir_saldo_retirar(){
float retirar=0;
do{
try{
System.out.print("Saldo a retirar => ");
BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in));
retirar=Float.parseFloat(stdin.readLine());
if(retirar<1){
System.out.println("El saldo a retirar debe ser mayor... |
e314ef65-4e0c-4bed-8abc-2231e3d2cb14 | 0 | public String readPassword()
{
String result = "";
result = SourceLoader.loadFile(PASSWORDFILE).trim();
return result;
} |
6c484777-7d3a-4063-a03f-c38ab49f5ee2 | 9 | public void prepareAttributes() throws XPathException {
String selectAtt = null;
String disableAtt = null;
String separatorAtt = null;
AttributeCollection atts = getAttributeList();
for (int a=0; a<atts.getLength(); a++) {
int nc = atts.getNameCode(a);
String f = getNamePool().getClarkName(nc);
if... |
3cf1f1e0-c29a-4c77-9c2a-50c833bd6f99 | 5 | public static void editLine(Player p, String line) {
if (line == null) {
editLine = false;
editLineN = 0;
editLineText = null;
MessageManager.getInstance().info(p, t.get("t_disabledEditLine"));
return;
}
int l = 0;
try {
l = Integer.parseInt(line);
} catch (Exception e) {
MessageManager.... |
cb7483fb-6fd9-49ec-9a17-ee117c29aeed | 1 | static public SolicitudCertificado instancia() {
if (UnicaInstancia == null) {
UnicaInstancia = new SolicitudCertificado();
}
return UnicaInstancia;
} |
8524c17a-1a9c-4c98-8932-3015df90a7c5 | 2 | public void copyRect(int x, int y, int w, int h, int srcX, int srcY) {
int dest = (width_ * y) + x;
int src = (width_ * srcY) + srcX;
int inc = width_;
if (y > srcY) {
src += (h - 1) * inc;
dest += (h - 1) * inc;
inc = -inc;
}
int destEnd = dest + h * inc;
while (dest != ... |
fc006249-06ea-4a07-8cc1-837d1179bc4b | 5 | public void save(String fileName,boolean rewrite){
try{
File outFile = new File(fileName);
if(outFile.exists()&&rewrite){
if(JOptionPane.showConfirmDialog(null, "File already exists. Rewrite it?","File exits",JOptionPane.YES_NO_OPTION)==JOptionPane.NO_OPTION)
return;
}
FileWriter fw = new ... |
d5a244dc-21aa-4bb4-b7aa-87cb56893919 | 3 | final Entry<V> removeEntryForKey(int key) {
int hash = hash(key);
int i = indexFor(hash, this.table.length);
Entry prev = this.table[i];
Entry e = prev;
while (e != null) {
Entry next = e.next;
if (e.key == key) {
this.modCount += 1;
this.size -= 1;
if (prev == e... |
727207ea-1d73-413a-88a7-29d8d4cff67a | 8 | private boolean isMatch(BSTNode<T> haysack, BSTNode<T> needle) {
// if both the nodes are null its considered as match
if(haysack == null && needle == null) {
return true;
}
// if one of them is null and other one is not .. consider it as not match
if((haysack == null... |
0e2f3f4b-c8f0-4094-ad7d-088233d4e8ae | 4 | public void getMultiplier() throws Exception {
Object st = null;
st = JOptionPane.showInputDialog(null,
"Increase tempo by how many times?\n" +
"Please type an integer.", "File Splitter",
JOptionPane.INFORMATION_MESSAGE, null, null, "1");
... |
5ae9b417-0110-4da5-90b7-34b9f32289a8 | 8 | public void CriarCompeticao(String Nome, String escalao, Collection<String> equipa, int tipo, String torneio, String date) throws Exception {
int year = Calendar.getInstance().get(Calendar.YEAR);
if (tipo == 0) {
if (!DAOCompeticao.containsKey(escalao)) {
Competicao comp = ne... |
ca677e44-893f-4ba9-91b2-92323abfb14d | 1 | public void removePropertyChangeListener(PropertyChangeListener listener) {
this.riverChangeSupport.removePropertyChangeListener(listener);
for (River r: rivers) {
r.removePropertyChangeListener(this);
}
} |
a5154a34-42a0-445a-b7c7-3a734f3436c1 | 3 | public String[] interpret(String[] result, Symtab st, Taccount account) {
if (pm != null) {
result = pm.interpret(result, st, account);
} if (pmc.f != null)
result[1] += pmc.interpret(st, account);
else if (pmc.sd != null)
result[0] += pmc.interpret(st, account);
return result;
} |
f484dd2d-86b3-4534-b243-d697675fe244 | 8 | public Boolean getSignForPointInSpace(Point p) throws OctNodeException {
if (p.getDimensions() != this.getDimensions())
throw new InvalidArgumentOctNodeException();
try {
if (this.getBoundingBox().pointInBox(p) == false) return false;
} catch (GeometryException ge) { thro... |
f8980f9d-ab4b-4312-895e-c8b694e92e7d | 1 | public void setPublic(final boolean flag) {
int modifiers = classInfo.modifiers();
if (flag) {
modifiers |= Modifiers.PUBLIC;
} else {
modifiers &= ~Modifiers.PUBLIC;
}
classInfo.setModifiers(modifiers);
this.setDirty(true);
} |
d140fb84-bf4d-423b-af3e-d0fb3503568d | 7 | public boolean AttackNPC(int NPCID) {
if(server.npcHandler.npcs[npcs[NPCID].attacknpc] != null) {
int EnemyX = server.npcHandler.npcs[npcs[NPCID].attacknpc].absX;
int EnemyY = server.npcHandler.npcs[npcs[NPCID].attacknpc].absY;
int EnemyHP = server.npcHandler.npcs[npcs[NPCID].attacknpc].HP;
int hitDiff = 0;... |
6f37f2c2-c1bd-404a-a527-10cc8d1d8518 | 5 | private void cmdJOIN(ArrayList<String> args) {
if (status == HANDSHAKE_SUCCESFULL) {
if (args.size() >= 0 && args.size() <= 1) {
int slots = server.getBestLobby();
try {
if (args.size() == 1) {
slots = Integer.parseInt(args.get(0));
}
} catch (NumberFormatException e) {
// if args.... |
f97ebfca-e0ee-4cd3-8cf9-27c4fba8b294 | 2 | CPGreyBmp makeHorizLinesTexture(int lineSize, int size) {
CPGreyBmp texture = new CPGreyBmp(size, size);
for (int i = 0; i < size * size; i++) {
if (i / size >= lineSize) {
texture.data[i] = (byte) 255;
}
}
return texture;
} |
4ee29a45-ef0c-4dec-947b-074906cf4313 | 0 | @Override
public int getHeight() { return height; } |
1656e905-6e3b-412d-8410-8fd6afff9718 | 7 | public static void main(String[] args) {
String friendsFile = "/Users/matthiasfelix/git/RecommenderSystem/RecommenderSystem/artificial/friendsA01.txt";
String ratingsFile = "/Users/matthiasfelix/git/RecommenderSystem/RecommenderSystem/artificial/";
String rootPath = "/Users/matthiasfelix/git/RecommenderSystem/R... |
0e4b96ed-b356-4f8c-b455-66624728668a | 2 | private boolean isClassInFolder(String fileName)
{
String[] files;
//check if file is in the folder
files = folderFile.list();
for (int i = 0; i < files.length; i++)
{
if (this.className.equals(files[i]))
{
return true;
... |
efefe39b-605a-4576-a887-61fa111a7966 | 1 | public void endTag() throws XMLStreamException {
mDepth--;
if (!mHadText) {
eol();
} else {
mHadText = false;
}
mWriter.writeEndElement();
} |
735503d2-a63b-4db8-a8c1-c63a8c9f31e0 | 4 | @Override
public void keyPressed(KeyEvent ke) {
if(ke.getKeyCode() == KeyEvent.VK_LEFT){
left = true;
} else if(ke.getKeyCode() == KeyEvent.VK_RIGHT){
right = true;
}
if(ke.getKeyCode() == KeyEvent.VK_UP){
up = true;
} else if(ke.getKeyCode() == KeyEvent.VK_DOWN){
down = true;
}
} |
f53aec8d-2cdd-48fc-b991-95a6e8bc508e | 0 | @Test
public void shouldReturnAreaOfTwelveForThreeByFourRectangle(){
Rectangle rectangle = new Rectangle(3, 4, 0, 0);
assertEquals(12, rectangle.area());
} |
bb3fef7e-6671-45d1-851c-6b57ea0c7a88 | 3 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((accessToken == null) ? 0 : accessToken.hashCode());
result = prime * result
+ ((expireIn == null) ? 0 : expireIn.hashCode());
result = prime * result
+ ((refreshToken == null) ? 0 : refreshToken.hashCode... |
740dfe50-7d14-4d5a-83b6-7581d3d87581 | 1 | private static String m(long n, String s) {
return n + " " + s + (n == 1 ? "" : "s");
} |
34e8439e-f776-4c10-ae3a-8c27d280ef81 | 4 | @Override
public void deserialize(Buffer buf) {
position = buf.readUByte();
if (position < 0 || position > 255)
throw new RuntimeException("Forbidden value on position = " + position + ", it doesn't respect the following condition : position < 0 || position > 255");
objGid = buf.... |
f557a8b7-5dd0-4482-97a7-a4a3422af2d7 | 6 | public void allocateStats() {
String s;
try {
while (mc.getStatPoints() > 0) {
System.out.println("You must use all stat points.");
System.out.println("Stat Points Remaining: "
+ mc.getStatPoints());
System.out.println("... |
77744a59-72cd-4024-8f9e-9a50fec0972a | 6 | public void run(){
//Run until interrupted.
while(true){
try{
System.out.println("processing");
ref = queue.remove();//ref:reference to a key
res = null;
synchronized(ResourceManager.this){
res = refs.get(ref);//res:an object mapping by the key of "ref"
refs.remove(ref);
}... |
ce2f0bde-db3f-4dc5-ba77-c0bc5f39c54f | 6 | private void sysCallExec()
{
//If there is nothing to run, abort. This should never happen.
if (m_programs.size() == 0)
{
System.err.println("ERROR! syscallExec has no programs to run.");
System.exit(-1);
}
//find out which program has been ... |
75009d85-b63a-45fa-bace-9ef9318e7908 | 4 | protected int findClosest(Color c) {
if (colorTab == null) return -1;
int r = c.getRed();
int g = c.getGreen();
int b = c.getBlue();
int minpos = 0;
int dmin = 256 * 256 * 256;
int len = colorTab.length;
for (int i = 0; i < len;) {
int dr = r - (colorTab[i++] & 0xff);
int dg = g - (colorTab[i++] &... |
95dc3c0e-ca2d-42e8-9592-a8442f0734ee | 4 | public void readMails(String folderName) {
properties = new Properties();
properties.setProperty("mail.host", "imap.gmail.com");
properties.setProperty("mail.port", "995");
properties.setProperty("mail.transport.protocol", "imaps");
session = Session.getInstance(properties,
new javax.mail.Authenticator() ... |
416d560a-c71f-40e9-81ce-8161403b94e4 | 0 | protected void onSetModerated(String channel, String sourceNick, String sourceLogin, String sourceHostname) {} |
8adf122c-08f4-45fc-8d10-b684027a12ae | 0 | public boolean isFirstMove() {
return this.moveCount == 0;
} |
355b02aa-5264-42f8-b0d0-5c0a8fa2395c | 6 | public static void recordAndIntroductionJustification(ControlFrame frame, Keyword lastmove) {
{ Vector conjuncts = ((Vector)(KeyValueList.dynamicSlotValue(frame.dynamicSlots, Logic.SYM_STELLA_ARGUMENTS, null)));
Cons antecedents = Stella.NIL;
if (lastmove == Logic.KWD_UP_TRUE) {
{ ControlFrame ... |
aa5cf828-014c-436a-8205-95b0b8fc1d00 | 5 | public static void main(String[] args) throws Exception {
BeeCommandLineParser arguments = BeeCommandLineParser.parse(args);
// average available surface: 29ha
// 1ha = 10000 square meters -> 29ha = 290000 square meters ->
// sqrt(290000) approximately 540m -> Env(-270, 270, -270, 270)
BeeSimulation simulat... |
dbe94b83-689a-461e-8a97-949edbb99a09 | 6 | public void setMaxSize(int newMaxSize)
{
if(newMaxSize < 0)
{
System.out.println("New size must be a nonnegative integer. " +
"maxCount has not been modified.");
return;
}
if(newMaxSize == maxCount)
{
return; ... |
0c808b9d-269d-434b-a1b5-3a5fd0f1e1c5 | 0 | public double getAltitude()
{
return altitude;
} |
5ee25de5-e830-4f55-a713-04904552756a | 6 | private boolean dupi(char[] c) {
for (int i = 0; i < c.length; i++) {
if (c[i] != ')') {
// if not closing bracket or a token
stack1.push(c[i]);
} else {
// if a closing bracket
char k = stack1.pop();
boolean tokenize = false;
while (k != '(') {
if (k != '(' || k != ')') {
to... |
f1a67de5-2428-4bbd-83da-84adfc9032f0 | 1 | private synchronized static void createInstance() {
if (instance == null) {
instance = new FamilyService();
}
} |
02c2540e-fa14-4039-837d-cb75dacbc9f1 | 1 | public static void printWithColor(String color, String message){
try{
Colores col = Colores.valueOf(color.toUpperCase());
System.out.print("\034[" + col.cod + "m" + message + "\033[30m");
}catch (IllegalArgumentException e){
System.out.println("\033\tError: " + e.getM... |
c0dc989a-1043-44fe-bfd6-5f6fdd12dd24 | 6 | @Override
public void run( ){
while( keepDispatching ){
try{
Message event = MESSAGE_QUEUE.take();
MessageType type = event.getType();
int dispatchedCount = 0;
for( MListener listener : ELIST ){
if( listener.isSupported( type ) ){
... |
e58bbf14-cf92-46e5-a4d1-385bbf771dbd | 0 | public void setId(String value) {
this.id = value;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.