method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
dad6a258-3fc8-407f-b3f9-4bf9278be2c9 | 1 | public boolean benutzerErstellen(String benutzername, String passwort,
int oeEinheit) {
Benutzer neu = dbZugriff.neuerBenutzerErstellen(benutzername, passwort,
oeEinheit, Optionen.isInitialbelegungbenutzergesperrt());
if (neu == null) {
return false;
} else {
return true;
}
} |
d0da3fbd-dfaf-455c-902a-df21d01c3cc9 | 0 | public int getId() {
return id;
} |
fb5a7387-b58a-4a51-b0cf-bf274481b738 | 8 | private int setUpForEval(BitSet subset) throws Exception {
int fc = 0;
for (int jj = 0;jj < m_numAttributes; jj++) {
if (subset.get(jj)) {
fc++;
}
}
//int [] nbFs = new int [fc];
//int count = 0;
for (int j = 0; j < m_numAttributes; j++) {
m_theInstances.attribute(j).setWeigh... |
472478a5-3f43-4cfe-a573-8f3cbc4fcf86 | 0 | public void setMatches(Vector matches) {this.matches = matches;} |
af5649e5-00be-430c-9316-e4fe891b5b2d | 0 | @BeforeClass
public static void setUpClass() {
} |
8ac63ec6-e69e-4039-9f0b-930ac266e496 | 2 | @Test
@Ignore
public void test_AttendanceResponseListGet()
{
AttendanceResponseList laAttRespList = laClient.getAttendanceResponseList(5,
"2012-01-01-08.00.00.000000");
System.out.println(laAttRespList.getAttendanceResponseList().size());
if (laAttRespList.getAttendanceResponseList().size() > 0)
{
for... |
94661c87-f7ff-402c-a905-c2660573ea04 | 0 | public int getPrice()
{
return price;
} |
9556c7d5-3d96-4ad0-8ac3-8ec22c0288c4 | 3 | public int AddParagraph(String Text, String ID) {
//Controllo se l'ID sia presente nella lista
for (int i = 0; i < this._MyParagraphList.size(); i++) {
if (this._MyParagraphList.get(i).GetID().equals(ID)) {
//Creo il paragrafo che andrà a comporre il paragrafo
... |
843a4371-1687-4983-8aea-36dd75f7ae89 | 2 | static void drawBg1(Graphics2D ctx, Game game, World world) {
if (bg == null) {
bg = new BufferedImage(1200, 800, BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = (Graphics2D) bg.getGraphics();
g2d.setPaint(textures.toTexture(21*12+9, 18));
g2d.fillRect(0,0,1200,800)... |
91da5c52-48c8-4837-8d88-92299434cb47 | 1 | public final JSONArray getJSONArray(String key) throws JSONException {
Object o = get(key);
if (o instanceof JSONArray) {
return (JSONArray)o;
}
throw new JSONException("JSONObject[" + quote(key) +
"] is not a JSONArray.");
} |
ec5c7c86-1e37-4590-8876-3b7169a03e4f | 5 | public final Writer write(Writer writer) throws JSONException {
try {
boolean b = false;
int len = length();
writer.write('[');
for (int i = 0; i < len; i += 1) {
if (b) {
writer.write(',');
}
... |
2af84631-3a97-4f12-ab72-efee5d4e034f | 4 | public void updateRoom(Room newRoom) throws IllegalArgumentException {
int oldRoomIndex = -1;
for (int roomIndex = 0; roomIndex < rooms.size(); ++roomIndex) {
if (rooms.get(roomIndex).equals(newRoom) &&
rooms.get(roomIndex).getRoomID() != newRoom.getRoomID()) {
... |
28ed573c-f5f8-4afe-ad53-1b6a0591c659 | 0 | public PumpingLemma get(int i)
{
return (PumpingLemma)myList.get(i);
} |
1341605f-4116-4320-846c-8d16dd940f57 | 2 | public static List<String> complement(List<String> list_1,
List<String> list_2) {
List<String> result_list = new ArrayList<>();
for (String element : list_1) {
if (list_2.contains(element)) {
result_list.add(element);
}
}
return result_list;
} |
480dfd9f-2ebf-4961-b1aa-36144b873fd0 | 0 | public void setSize(Dimension size) {
generateUnit(size);
} |
419c63cc-4cb9-4c38-b7e5-65045d2ddfec | 2 | public static String currencyName2(String c1, String c2){
Connection conn = DBase.dbConnection();
PreparedStatement dbpst;
String curName2 ="";
try{
String query = "Select CurrencyName FROM "+c1+ " where CountryCode = ?";
dbpst=conn.prepareStatement(query);
... |
cae8e769-dd87-4663-b160-d72e0b28231c | 8 | static final public String RelationalExpression() throws ParseException {
String tmp1="",tmp3="";Token tmp2=null;
tmp1 = ShiftExpression();
if (jj_2_23(2)) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 97:
tmp2 = jj_consume_token(97);
break;
ca... |
03e40196-bc78-4410-bbfa-eae4cd098862 | 3 | @Override
public Integer get(int index) {
switch(index) {
case 0: return x;
case 1: return y;
case 2: return z;
default: throw new IndexOutOfBoundsException();
}
} |
a22a33f8-9d09-4697-a7dd-def557a8c4cf | 1 | static int getLength(LinkedList list) {
int size = 0;
int n = list.size();
for (int i = 0; i < n; ++i) {
AttributeInfo attr = (AttributeInfo)list.get(i);
size += attr.length();
}
return size;
} |
6f1bc672-bd7c-4283-b8de-883ffbf6386d | 3 | public void paintShape(Graphics2D g2)
{
if (color != null)
{
label.setForeground(new java.awt.Color((int) color.getRed(), (int) color.getGreen(), (int) color.getBlue()));
Dimension dim = label.getPreferredSize();
if (dim.width > 0 && dim.height > 0)
{
... |
c4950daa-d3f2-4048-81a5-7413566d2213 | 8 | Circle addDigit(boolean digit)
{
Circle newCircle = new Circle(digits, hash);
ArrayList<Boolean> newDigits = newCircle.digits;
boolean[] newHash = newCircle.hash;
newDigits.add(digit);
byte middleHash = 0;
for (byte i = N; i > 0; i--)
if (newDigits.get(newDigits.size()-i))
middleHash += (by... |
969fa2a6-6514-4a65-8cf2-e633b64667fa | 9 | void assertConsistent() {
lock.lock();
try {
if (requiresEviction()) {
throw new AssertionError("requires evictions: size=" + mostRecentlyUsedQueries.size()
+ ", maxSize=" + maxSize + ", ramBytesUsed=" + ramBytesUsed() + ", maxRamBytesUsed=" + maxRamBytesUsed);
}
for (LeafC... |
a5a5682c-9cd6-49cd-80ee-69ac7626a9a9 | 8 | public Image getImage() {
if ( text != null && image == null ) {
// Create the text image
image = new BufferedImage(pos.width, pos.height, BufferedImage.TYPE_INT_RGB);
Graphics2D g = image.createGraphics();
if ( font != null )
g.setFont(font);
// If the user didn't set the size, then we should re... |
9505ed97-c9d2-4622-ad4c-cb8a6c474767 | 4 | public TaskListTablePanel(TaskListTableModel taskListTableModel)
{
super();
Objects.requireNonNull(taskListTableModel);
tasksBeingEdited = 0;
ActionListener al = new TaskPanelActionListener(this);
setLayout(new BorderLayout());
JPanel topPanel = new JPanel();
topPanel.setLayout(new BorderLayout());
... |
27111e94-ead8-48e0-9409-0f8fdf7a066c | 6 | public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... |
dc17cfdc-cdfb-40b5-ac24-2dba261afa86 | 4 | @Override
public MoveResult makeMove(HantoPieceType pieceType, HantoCoordinate from, HantoCoordinate to) throws HantoException {
HantoPlayerColor color;
HantoPiece piece;
MoveResult result;
color = whoseTurnIsIt();
// switch case for adding different types of game pieces
switch(pieceType) {
case... |
77fda23a-c7de-40f6-8392-2817ed0b0fc4 | 1 | @Override
public void mouseClicked( MouseEvent e ) {
for( MouseListener listener : listeners( MouseListener.class )){
listener.mouseClicked( e );
}
} |
25a822f6-1b6a-4ef2-b307-146d5aec09b5 | 5 | public static void main(String[] args) {
if (args.length != 3) {
System.out.println(USAGE);
System.exit(0);
}
String name = args[0];
InetAddress addr = null;
int port = 0;
Socket sock = null;
// check args[1] - the IP-adress
try {
addr = InetAddress.getByName(args[1]);
} catch (UnknownHostExc... |
08d6cd47-640d-4ae1-ada8-372c932515c1 | 0 | public ProtocolChatMessage(int type, String content) {
mType = type;
mContent = content;
} |
154e6ca1-1dd6-417a-8373-4069453d3d38 | 5 | public double standardDeviation_as_double() {
boolean hold = Stat.nFactorOptionS;
if (nFactorReset) {
if (nFactorOptionI) {
Stat.nFactorOptionS = true;
} else {
Stat.nFactorOptionS = false;
}
}
double variance = 0.0D;
switch (type) {
case 1:
double[] dd = this.getArray_as_double();
v... |
87d86a1f-c4b4-4d41-9f3c-c9fc5957e1e7 | 9 | public boolean groupSum5(int start, int[] nums, int target) {
if (start >= nums.length) return (target == 0);
if (nums[start] % 5 == 0) {
if (groupSum5(start + 1, nums, target - nums[start])) return true;
} else if (start != 0 && nums[start] == 1 && nums[start - 1] % 5 == 0) {
... |
01e6134a-95fb-4e95-b1ff-a56f2d9a37be | 1 | public String toString() {
try {
return this.toJSON().toString(4);
} catch (JSONException e) {
return "Error";
}
} |
c1abf182-4e47-4fe1-9375-11ac2c2d7a87 | 9 | public void nextQuestion() {
boolean exit = false;
while (!exit) {
++_currentQuestionNumber;
if (_currentQuestionNumber >= _questionsList.length) {
_currentQuestionNumber = 0;
}
final QuestionsDatabase questionDatabase = new QuestionsDatabase();
int questionNumber = _questionNumbers.get(_questi... |
fb22798f-9b13-444d-9d24-37da632d173f | 1 | public void insertCorporation(int ID, String name, String address, String email) throws SQLException {
if (conn != null) {
Corporation corporation = new Corporation(ID, name, address, email);
corporation.insert(conn);
}
} |
a1f63765-0e09-42ce-9f0b-6bedb3ca6a9d | 5 | public Object[][] make_data_file(){
String[][] data= new String[this.tank_count][3];
for(int i=0; i<this.tank_count; i++){
data[i][0]=this.tanks_available[i].get_name();
String errormessage="";
switch (this.errors[i]){
case 0:
errormessage="";
break;
case 1:
errormessage="you can p... |
393364b4-c095-4134-8987-26cd95010f1f | 7 | public void renderTile(int xp, int yp, Tile tile)
{
xp -= xOffset;
yp -= yOffset;
for(int y = 0; y < tile.sprite.SIZE; y++)
{
int ya = y + yp;
for(int x = 0; x < tile.sprite.SIZE; x++)
{
int xa = x + xp;
if(xa < -tile.sprite.SIZE || xa >= width || ya < 0 || ya >= height) break;
if(xa < 0) ... |
669514ab-375a-46bd-8ff1-1db254744a09 | 6 | private void backTrackToCNF()
{
if (myCNFMap==null)
{
backTrackToUnit();
return;
}
// System.out.println("MAP : "+myCNFMap);
int[] visited=new int[myTrace.size()];
for (int i=0; i<myTrace.size(); i++)
{
if (visited[i]==0)
{
Production target=myTrace.get(i);
if (myCNFMap.keySet().co... |
b0f96a9e-3ec5-43e5-ac3c-0582e911abd0 | 9 | public MiOSDeployHelper() {
setMacOsFeatures();
MouseHandler mouseHandler = new MouseHandler();
setResizable(false);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 509, 367);
createMenu();
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setConte... |
a4698079-3e2f-41e2-84dc-d2984e335ed5 | 4 | @Override
public CreativeMaterialType getTypeByName(final String name) throws WrongTypeNameException {
if (name == null) {
throw new WrongTypeNameException("Type name is empty");
}
switch (name) {
case SLIDES_TYPE_NAME:
case VIDEO_TYPE_NAME:
ca... |
82e9ba87-272c-41e9-936a-631f39e1c44a | 3 | public void poll() {
if (runningJob != null) {
// check if the job has finished
if (System.currentTimeMillis() - startTime > runningJob.getDuration()) {
// job done
runningJob.setStatus(JobStatus.Done);
// fire event handler
for (INodeEventHandler handler : handlers)
handler.jobDone(runni... |
55650d6e-91a0-4115-b5d8-da74da365bcf | 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... |
cdf005a8-0bf5-45cc-a19e-0f9d6a5c3afa | 4 | public int score(WordChain word) {
int score = 0;
int size = word.getLetterChain().size;
;
if(size <= 3){
score += size;
}else if(size ==4){
score += 5;
}else if(size ==5){
score += 7;
}else if(size == 6){
score += 10;
}else{
score += 15;
}
return score;
} |
e62b692c-43e0-464b-9731-2d8c759bd10f | 0 | public void move(int x, int y)
{
int newX = this.GetX() + x;
int newY = this.GetY() + y;
this.SetX(newX);
this.SetY(newY);
} |
93afd67c-d3e4-4635-b243-9048caf84ac0 | 0 | public void setDirectionY(int a){
directionY = a;
} |
12653dcd-4b61-447a-99df-97382a2339b3 | 5 | public BinaryNode getSuccessor()
{
if(hasChildren()){
if(getLeft() == null && getRight() != null)
return getRight();
else if(getLeft() != null && getRight() == null)
return getLeft();
else // the two children case
return getRight().getLeftmostNode();
}
return null;
} |
d14aae7b-adb8-4b5e-a898-fb1c97f0daf9 | 3 | private void list() {
if (connections.isEmpty()) {
UI.setError("No hay conexiones activas");
} else {
UI.clearError();
Connection connection;
int i;
UI.printHeader();
System.out.println(connections.size() + " conexiones activas:");
System.out.println("");
for (i = 0; i < connections.size()... |
dd135d21-a7c7-4018-a663-2691f974ca85 | 6 | public boolean CheckForCollisionCustom(String name, int posX, int posY, int width, int height)
{
/* NOTES:
*
* - A string value matching [""] will mean that there
* will be no name checking for the collision.
*
* */
//Creating the variables
boolean checkBoolean = false;
boolean checkName ... |
6f402c3c-0ed8-4948-ad9c-fa235067122f | 5 | public void processHost(int userLevel, String channel, String sender, String hostname, String message, boolean autoRestart, int port) {
logMessage(LOGLEVEL_NORMAL, "Processing the host command for " + Functions.getUserName(hostname) + " with the message \"" + message + "\".");
if (botEnabled || isAccountTypeOf(user... |
267356e8-a9eb-461b-9a9b-871986c3fc9a | 7 | public void serial(List<Matchable> patterns) {
boolean[] flags = new boolean[patterns.size()];
for (int i=0; i<flags.length; i++)
flags[i] = false;
boolean terminate = false;
while (!terminate) {
Map<String, String> map = new HashMap<String, String>();
int index = -1;
String msg = "Generate object... |
03fccc11-61cb-4bf7-a80a-4279a2a987d9 | 1 | public boolean isPressed() {
if(isDisabled())
return false;
return pressed;
} |
78a3ec72-7f4f-482d-ba79-fd53954d53fb | 9 | @Override
public void run() {
boolean connected = false;
do {
connected = connect();
if( connected ) {
log.info("Connected to server "+ serverConnection);
} else {
log.info("Can't find server "+ serverConnection +" ... trying to reconnect");
Util.pause(1);
}
} while( !connected );
Se... |
3c9baa51-7505-4bda-84b1-9b0e87c2b507 | 5 | protected void moveLabel(MouseEvent e)
{
mxGraph graph = graphComponent.getGraph();
mxGeometry geometry = graph.getModel().getGeometry(state.getCell());
if (geometry != null)
{
double scale = graph.getView().getScale();
mxPoint pt = new mxPoint(e.getPoint());
if (gridEnabledEvent)
{
pt = grap... |
1c141b86-660e-4d33-a92f-5c6eb964e0c6 | 1 | public int checkTileForWater(int i) {
if (isWater(players.get(i).getPosition()) == true) {
// check for water
System.out.println("Water tile detected");
Position startPos = players.get(i).getTrail().get(0);
players.get(i).ResetTrail();
players.get(i).setPosition(startPos);
System.out
.println(... |
af5246b9-12fb-443b-bfeb-cf4a00eeb3cc | 8 | public void postOrder() {
try {
if (!customerExisting) {
customerFacade.create(customer);
customerFacade.flush();
}
Random random = new Random();
int i = random.nextInt(999999999);
Date date = new Date();
cu... |
d1f3dfaf-2608-4bcb-9481-f1dad5c9e047 | 2 | public boolean requestFriendship(Person otherPerson) {
if (this.friends.contains(otherPerson)){
return true;
}
if(this.sendMessage(otherPerson, "/friend")){
this.friends.add(otherPerson);
return true;
}
return false;
} |
44f2dd40-0ad5-43bd-b9e3-29593bd88d50 | 1 | private void mergeFinallyBlock(FlowBlock tryFlow, FlowBlock catchFlow,
StructuredBlock finallyBlock) {
TryBlock tryBlock = (TryBlock) tryFlow.block;
if (tryBlock.getSubBlocks()[0] instanceof TryBlock) {
/*
* A try { try { } catch {} } finally{} is equivalent to a try {}
* catch {} finally {} so remove... |
1dc0f425-bdc1-48f6-81ee-fb35fccc645d | 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... |
ad5b9760-bb7b-4547-9b8e-e0cdd6250f39 | 2 | private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
String tmpcod = JOptionPane.showInputDialog(this, "Introdusca su codigo", "Captura de codigo", JOptionPane.QUESTION_MESSAGE);
Usuarios us = new Usuarios(tmpcod, null, null);
Usuari... |
d5052066-66bb-4af4-bc8d-12645557663a | 8 | public void update(){
if(!won && !dead){
if(hasStarted){
elapsedMS = (System.nanoTime() - startTime) / 1000000;
formattedTime = formatTime(elapsedMS);
}
else{
startTime = System.nanoTime();
}
}
checkKeys();
if(score >= highScore){
highScore = score;
}
for(int row = 0; row... |
f7534b7b-6a24-48e7-9b2c-cd985641336b | 0 | public Ability(String name, String trigger) {
this.name = name;
this.trigger = trigger;
} |
c038c67b-b84e-48cb-a508-3cc730ca5009 | 1 | public boolean canHaveAsCreditLimit(BigInteger creditLimit) {
return (creditLimit != null) && (creditLimit.compareTo(BigInteger.ZERO) <= 0);
} |
b06f9284-77cc-4fac-8b59-37afcc011492 | 6 | public static int maxProfit(int[] prices) {
if(prices.length <= 1) {
return 0;
}
int max = prices[0];
int min = prices[0];
int maxPofit = 0;
for(int i = 0; i < prices.length; i++) {
if(prices[i] < min) {
int tmp = max-min;
if(tmp > maxPofit) {
maxPofit = tmp;... |
8f2a5221-206f-4465-af06-37ad171a2b4f | 9 | @Override
protected void onWriteContent(XMLStreamWriter toStream, PropertySet toObject, XMLFormatType toFormatType)
{
if (toObject == null || toObject.isEmpty())
{
return;
}
Object[] loKeys = toObject.getPropertyKeys().toArray();
Arrays.sort(loKeys);
... |
c5b2c212-6848-4ef1-8000-e0e3d828db00 | 4 | @Override
public boolean equals(Object o)
{
boolean isEqual = false;
if(o != null && o instanceof User)
{
User temp = (User) o;
if(temp.username.equals(this.username) && Arrays.equals(temp.password, this.password))
{
isEqual = true;
... |
7784ed59-d2f5-4e29-bc34-ebc4eab2a1a6 | 9 | private boolean duplicated(int a, int b, int max) {
int maxLoop = (int) (Math.sqrt(a) + 1);
for (int i = 2; i < maxLoop; i++) {
if (a % i != 0) {
continue;
}
int root = logn(i, a);
if (root == -1) {
continue;
}
int bPlus = b * root;
if (bPlus <= max) {
return true;
} else {
f... |
5aab88bf-c7eb-458c-ae8f-02ec9c0818dc | 1 | public static void stub(String string){
if(developerMode){
System.out.println("STUB: " + getClassName() + ":" + getMethodName() + "():" + getLineNumber() + ": " + string);
}
} |
80239c5c-836e-4ed9-8fbe-d046b8414431 | 7 | private String startToneHunt (CircularDataBuffer circBuf,WaveData waveData) {
String line;
final int HighTONE=1280;
final int LowTONE=520;
final int toneDIFFERENCE=HighTONE-LowTONE;
final int ErrorALLOWANCE=40;
// Look for a low start tone followed by a high start tone
int tone1=do1024FFT(circBuf,waveD... |
1daa3782-b20d-4cd0-a8ce-2b73f70c7177 | 9 | public boolean canHaveAsWall(Wall newW) {
for(Element e: elements) {
if(e instanceof Player) {
for(Position p : newW.getPositions()) {
if(e.getPosition().equals(p)) {
return false;
}
}
}
else if(e instanceof Wall) {
Wall w = (Wall) e;
//if(w.getDirection().equals(Directio... |
898b3399-9ffc-4056-8536-c63a67543f85 | 0 | @After
public void tearDown() throws Exception {
this.service = null;
} |
9fc698d7-9bf8-4c65-a82f-6a27d9aae67c | 2 | private void paintPauseScreen(Graphics2D g){
g.setFont(pauseFont);
if (fm == null){
initClickAreas();
}
if (inOptions)
drawOptions(g);
else
drawPauseScreen(g);
} |
f2306b1e-0222-46c9-b0c6-fb6234387896 | 4 | private int jjMoveStringLiteralDfa3_4(long old0, long active0) {
if (((active0 &= old0)) == 0L)
return 3;
try {
curChar = input_stream.readChar();
} catch (java.io.IOException e) {
return 3;
}
switch (curChar) {
case 93:
if ((active0 & 0x100000L) != 0L)
return jjStopAtPos(3, 20);
break;
... |
253a9350-cc2e-4aee-aaf5-eac1ada776df | 0 | public Tile[] getNeighbors() {
return neighbors;
} |
7f296e9f-f225-4a7b-837f-610b707c4dc4 | 1 | public static int compare(String s1,String s2) {
if (collator==null)
collator = java.text.Collator.getInstance();
return collator.compare(s1,s2);
}; |
e0df7814-64d1-4342-978a-6ef04a8c17d7 | 8 | public boolean equals(Object other) {
if (other instanceof Tuple) {
Tuple otherTuple = (Tuple) other;
return
(( this.first == otherTuple.first ||
( this.first != null && otherTuple.first != null &&
this.first.equals(otherTuple.first))) &&
( this.second == otherTuple.secon... |
224c7cbb-3ac5-4f4e-87ab-bd84a1a2be89 | 0 | public int getZoomLevel() {
return zoomLevel;
} |
ff59aa3d-6b2a-4ec8-bd3c-f2b5c88059e2 | 7 | private void initialize() {
PSOUtil.reset();
Particle bestPreviousIndividual = this.initialIndividual!=null ?
new Particle(this.initialIndividual.getPersonWorkLists()) : null;
Particle initialParticle = null;
if (bestPreviousIndividual != null) {
initialParticle = (Particle) bestPreviousIndiv... |
d384a93a-551e-458f-adac-25238e7c2b73 | 8 | public static final int[] adjustXYByDirections(int x, int y, final int direction)
{
switch(direction)
{
case Directions.NORTH:
y--;
break;
case Directions.SOUTH:
y++;
break;
case Directions.EAST:
x++;
break;
case Directions.WEST:
x--;
break;
case Directions.NORTHEAST:
x++;
y... |
89c326ab-b1fe-4ed5-95fd-d89f90c2d99d | 9 | @Override
public float[] getWordEntropies(int[] iids) {
// check to make sure that nodes exist for every id
for(int i = 0; i < iids.length; i++)
if(root.getChild(iids[i]) == null)
iids[i] = this.findUnknownId(vocab.getSymbol(iids[i]));
wordEnts = new float[iids.length-1];
simpleEnts = new float[iids.len... |
8b032ed8-372e-418a-9d52-e5bc610a7fd1 | 8 | public void continueGame(){
while(continueHit && player.getHandTotal() < 21){
playerPlay();
if(continueHit)
player.printHand();
}
System.out.println("--- Dealer's turn ---");
while(continueDealerHit && dealer.getHandTotal() < 21){
dealerPlay();
}
dealer.printHand();
System.out... |
20ced934-b73c-40b0-bdc0-c54785756858 | 3 | private void carregaBairrosAssesoria(String idCidade){
if(comboCidadeAssessoria.getSelectedItem().toString().equals("Selecionar....")){
System.out.println("Nenhuma cidade selecionada");
}else{
System.out.println("Carregando bairros...");
//String cod = String.... |
136ffea8-1f53-4721-989b-3f2ede1f9f1b | 2 | public void testAddDurationConverterSecurity() {
if (OLD_JDK) {
return;
}
try {
Policy.setPolicy(RESTRICT);
System.setSecurityManager(new SecurityManager());
ConverterManager.getInstance().addDurationConverter(StringConverter.INSTANCE);
... |
416d7713-89b2-412b-bb48-365967ef7ef8 | 9 | private void readTokenFromScanner(){
int length = tokenCache.length;
boolean tokenNotFound = true;
while(tokenNotFound) {
try {
int tokenKind = scanner.getNextToken();
if(tokenKind != TokenNameEOF) {
int start = scanner.getCurrentTokenStartPosition();
int end = scanner.getCurrentTokenEndPos... |
7c7dae88-c77a-435f-ac1a-c6942fe28f2a | 1 | private void hook() {
Thread ct = Thread.currentThread();
if(!(ct instanceof HackThread))
throw(new RuntimeException("Tried to use an HackSocket on a non-hacked thread."));
final HackThread ut = (HackThread)ct;
InterruptAction ia = new InterruptAction();
ut.addil(ia);
this.ia.set(ia);
} |
a0dffa18-7c20-4a02-a310-d99ed7d4d366 | 4 | private void menuAbrirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuAbrirActionPerformed
// TODO add your handling code here:
FileFilter f = new FileFilter() {
@Override
public boolean accept(File pathname) {
if (pathname.getAbsolutePath()... |
c0b68cb8-f552-41c5-9d6b-bec8cd02d8d5 | 1 | public void setAnnualBonus(double annualBonus) {
if (annualBonus < 0){
throw new IllegalArgumentException("Bonus must be greater than or equal to zero");
}
this.annualBonus = annualBonus;
} |
044272ed-6d68-4d66-b6ee-8e284585bca0 | 8 | private void handleResponsePacket(DatagramPacket packet) {
try {
String strPacket = new String(packet.getData(), 0, packet.getLength());
Log.d(LOG_TAG, "response=" + strPacket);
String tokens[] = strPacket.trim().split("\\n");
Log.d(LOG_TAG, "tokens.length=" + tokens.length);
String location = null;
... |
dbd464ae-5de3-463e-88f2-eb0a5a99a63d | 1 | public void testWithField3() {
Partial test = createHourMinPartial();
try {
test.withField(DateTimeFieldType.dayOfMonth(), 6);
fail();
} catch (IllegalArgumentException ex) {}
check(test, 10, 20);
} |
cf6aab21-5294-4c5c-b5d6-612e7a1ee964 | 6 | public void run() {
try {
ObjectOutputStream out = new ObjectOutputStream(server.getOutputStream());
ObjectInputStream in = new ObjectInputStream(server.getInputStream());
// --Mutil User but can't parallel
String [] arr= (String[]) in.readObject();
System.out.println(arr[0]+arr[1]);
switch (arr[0])... |
7a7fd7e4-d45f-4ae5-ba45-2a7bc10fd8cb | 9 | private void send(OutputStream outputStream) {
String mime = mimeType;
SimpleDateFormat gmtFrmt = new SimpleDateFormat("E, d MMM yyyy HH:mm:ss 'GMT'", Locale.US);
gmtFrmt.setTimeZone(TimeZone.getTimeZone("GMT"));
try {
if (status == null) {
... |
426e8f1e-0b45-4bb2-93cc-427c01cf7260 | 4 | void readAssignmentList(CommandSender sender, ResultSet resSet, String queriedPlayer)
{
String aState = "";
boolean assignmentFound = false;
try
{
sender.sendMessage("Auftragsliste von: " + ChatColor.GREEN + queriedPlayer);
sender.sendMessage("---... |
46c72251-22e3-4ed8-b49e-11abb5e66efe | 2 | public static void testArray() {
Array<Comparable<?>> myArray = new Array<Comparable<?>>(0);
// System.out.println("Set " + obj0 + " to " + 0);
// myArray.setElement(0, obj0);
// System.out.println(myArray);
// System.out.println("Last position: " + myArray.getLastPosition());
//
/... |
e4e17c89-1fcc-4cee-8ec5-f5b478eacf48 | 7 | public static Keyword scanCachedGoals(ControlFrame frame) {
{ Proposition proposition = frame.proposition;
Iterator iterator = ((Iterator)(KeyValueList.dynamicSlotValue(frame.dynamicSlots, Logic.SYM_STELLA_ITERATOR, null)));
AtomicGoalCache cachedgoal = null;
PatternRecord patternrecord = ((QueryI... |
670811e2-0e84-4ba7-8c5e-282fc50b7307 | 7 | private void initPWResetFontMenu(Color bg) {
this.pwResetBtnPanel = new JPanel();
this.pwResetBtnPanel.setBackground(bg);
this.pwResetBtnPanel.setLayout(new VerticalLayout(5, VerticalLayout.LEFT));
String initFontTmp = this.skin.getPWResetFont();
int initFontSizeTmp = this.skin.... |
cab27036-33d0-4027-8a6b-406dc7b349b0 | 0 | public String getRecipient() {
return recipient;
} |
d96e5c41-10d7-4e62-b4e7-2841e7dc83ef | 5 | private void flee() {
if (Utils.getDistance(this, World.getMonsterArray().get(DistList.indexOf(Collections.min(DistList)))) < 50) {
if (x < World.getMonsterArray().get(DistList.indexOf(Collections.min(DistList))).getX()) {
isLPress = true;
} else if (x > World.getMonsterArray().get(DistList.indexOf(Collecti... |
89e32167-9a6f-47b7-99b9-bfc709ac1c66 | 4 | private Rectangle getDragOverBounds() {
Rectangle bounds = new Rectangle(mDragOverNode.getX(), mDragOverNode.getY(), mDragOverNode.getWidth(), mDragOverNode.getHeight());
switch (mDragOverLocation) {
case NORTH:
bounds.height = Math.max(bounds.height / 2, 1);
break;
case SOUTH:
int halfHeight = Ma... |
f0c2c56a-c7d9-4503-bd6e-20d5874b1728 | 5 | public void handleKeyPress(int value) {
switch (value) {
case MinuetoKeyboard.KEY_UP:
this.keyUp = true;
break;
case MinuetoKeyboard.KEY_LEFT:
this.keyLeft = true;
break;
case MinuetoKeyboard.KEY_RIGHT:
this.keyRight = true;
break;
case MinuetoKeyboard.KEY_DOWN:
this.keyDown... |
23a39b1d-5749-4eca-b999-e7b505f38ae7 | 9 | public void populateEnemies(){
sprinters = new ArrayList<Sprinter>();
waiters = new ArrayList<Waiter>();
pacers = new ArrayList<Pacer>();
walkers = new ArrayList<Walker>();
spitters = new ArrayList<Spitter>();
enemies = new ArrayList<Enemy>();
Sprinter s;
Waiter w;
Pacer p;
Walker wa;
Spitter s... |
c517985e-9926-47d5-9955-7b7055afc690 | 8 | public static WordLocation parseWordLocation(String obj) {
WordLocation wl = new WordLocation();
String data[] = obj.split("\n");
if( data.length != 2)
return null;
String tokens[] = data[0].split("[=]|[\\{]|[\\}]|[,]");
try {
if(data[0].indexOf("WordLocat... |
1c142fd9-7fd5-4fb1-8774-ca33280c623c | 9 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(target.fetchEffect(ID())!=null)
{
mob.tell(L("You already healed by fire."));
return false;
}
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.