method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
3bc078f9-225c-4388-b9f9-6b1ef4f7df7e | 8 | public void render(float partialTick)
{
int mt = (int)(this.world.player.maxMoveTime/this.world.getTileAt(this.world.player.x, this.world.player.y).getWalkSpeed());
this.px = this.world.player.x*this.world.TILE_SIZE+(int)((this.world.player.nx-this.world.player.x)*(mt-this.world.player.moveTime+partialTick)*this.w... |
4abfa1a3-6f71-467a-b93d-813cfbd6a2cb | 1 | private Integer parent(int pos) {
if(pos == 0) return null;
return pos /2;
} |
9df1df45-6013-4cef-b3bc-7761181b2f8f | 1 | public boolean passable() {
return type.passable() && bomb == null;
} |
95c221e2-ab6d-46c6-bbd7-ee46e1e5ff72 | 5 | @Override
public void render(float interpolation)
{
super.render(interpolation);
if(anim == null)
return;
anim[getDirectionID(d)].render(playerPos, playerDim);
if(animationStart == -1)
animationStart = System.currentTimeMillis();
if(!turned)
Fonts.get("Jungle").drawCenteredString("Lives: "+Ga... |
487c7294-c685-40c8-bc52-c404f7452087 | 3 | public JSONWriter array() throws JSONException {
if (this.mode == 'i' || this.mode == 'o' || this.mode == 'a') {
this.push(null);
this.append("[");
this.comma = false;
return this;
}
throw new JSONException("Misplaced array.");
} |
9047b3e4-b48a-4696-9742-abdbd7c8225e | 1 | public void unPauseGame() {
board.unpause();
if (pauseMenu != null) {
removeChild(pauseMenu);
}
pauseMenu = null;
} |
fd2d348f-bc01-458e-88e6-8396809382e3 | 6 | public static boolean cambiarStatusPaquete(Paquete paquete, String status)
{
Document doc;
Long identificadorPaquete;
Element root,child;
List <Element> rootChildrens;
boolean found = false;
int pos = 0;
SAXBuild... |
62468e6a-a773-4ae0-837d-10fd2eb78dbe | 6 | public void paintHex( Point aHexIx, Color aColor, boolean aToggle)
{
if (0 <= aHexIx.x && aHexIx.x < myHexGrid.getNumHorizHexes()
&& 0 <= aHexIx.y && aHexIx.y < myHexGrid.getNumVertHexes())
{
Hex hex = myHexGrid.getHexes()[ aHexIx.x][ aHexIx.y];
if (aToggle)
{
... |
9f583bf0-7aea-4ac5-8054-0b4c90c13354 | 2 | public void setLabel(String label)
{
for(int i=0;i<markers;i++)
{
if(marker[i].isSelected())
{
marker[i].setLabel(label);
//break;
}
}
} |
2cd85b9d-c883-4079-ab2e-511bf7b66a77 | 3 | public void sortByLevel() {
Collections.sort(
images,
new Comparator<Card>() {
public int compare(Card a, Card b) {
if (a instanceof Climax) { //climaxes should sort to be after all level cards
if (b instanceof Climax) {
return 0;
}
return ... |
fe897c20-ad36-442b-8677-2860364d5496 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
FractalColourScheme other = (FractalColourScheme) obj;
if (colours == null) {
... |
74d11489-e98f-402a-be6d-9847180dba7f | 7 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
Physical target=mob;
if((auto)&&(givenTarget!=null))
target=givenTarget;
if(target.fetchEffect(this.ID())!=null)
{
mob.tell(mob,target,null,L("<T-NAME> <T-IS-ARE> already affected by @x1.",... |
9b392e11-d0fb-4348-af49-9770ef3e7c56 | 4 | private void cargaNAS(BufferedReader bf) throws IOException
{
String linea;
int indice;
double x,y,z,w;
Nodo nodo;
Elemento elemento;
do
{
linea = bf.readLine();
if(linea.startsWith("GRID"))
{
... |
15994752-ef03-40bc-8fb7-248f2b52d0a5 | 0 | public synchronized Object inspectNext() {
return queue.firstElement();
} |
95d8d58c-19bd-4a1b-9086-bfb52cadc2c6 | 3 | public void monitorFileCreate(Path file) {
try {
if(file.startsWith(sourceDir)){
Path subPath = sourceDir.relativize(file);
for(Path targetDir : targetDirs){
Path newPath = targetDir.resolve(subPath);
Files.createDirectories(newPath.getParent());
logger.info("cp "+file.toString()+" "+new... |
586cd7d5-eecb-4098-8f75-01e686255023 | 5 | @Override
public void run() {
byte[] buffer;
do {
try {
if (!active)
break;
int packageLength = input.readInt();
ByteBuffer wrapped = ByteBuffer.allocate(packageLength);
while (packageLength > 0) {
... |
154f9230-76d6-4abd-b81f-073e7bb38ed2 | 3 | public XEquation(String equation){
equ = new Equation(equation);
Vector<Variable> variables = equ.getVariables();
if(variables.size()==0){
x = new Variable("x");
}
else{
if(variables.size()!=1)
throw new EquationException("Invalid X Equation: " + equation);
x = variables.firstElement();
if(!x.... |
813c3a1e-52e9-4079-ae31-3f576bae8721 | 5 | @Override
public boolean equals(Object obj)
{
if (this == obj)
{
return true;
}
if (!super.equals(obj))
{
return false;
}
if (!(obj instanceof BigVersion))
{
return false;
}
... |
8bca5fd7-f108-458e-931c-251b3bf585f9 | 0 | @Override
public ArrayList<String> getLastErrors() {
return this.lastErrors;
} |
5e3b3e4b-7527-49e8-a907-8b84e46ea221 | 3 | public static Map<String, String> parseMetadata(File metadataFile) {
HashMap<String, String> result = new HashMap<>();
try (FileInputStream in = new FileInputStream(metadataFile)) {
List<String> lines = IOUtils.readLines(in);
for (String line : lines) {
String[] arr = line.split(":");
result.put(arr... |
69a52de8-34dd-4d52-81de-68bd53e248c3 | 5 | public void getList(int rep)
{
String tempQuery = "";
if(rep == 0) {
tempQuery = "SELECT memberid,lastname,firstname,midinit from member order by lastname";
}
else if(rep == 1) {
String searchText = searchBox.getText().toUpperCase();
... |
a0cdfec1-2701-4a26-aa87-e302a23c4bf4 | 6 | private static Event nextEvent() {
Event e = null;
if (Keyboard.next()) {
if (Keyboard.getEventKeyState()) {
e = new Event(EventType.KEY_PRESSED, Keyboard.getEventKey());
} else {
e = new Event(EventType.KEY_RELEASED, Keyboard.getEventKey());
}
}
if (Mouse.next()) {
if (Mouse.get... |
c48f1626-93a3-49c7-8954-e888834865b0 | 5 | private static void openConnection() {
try
{
System.out.println("Loading the driver...");
Class.forName("com.mysql.jdbc.Driver");
System.out.println("Loading successed ---------------");
String jsonEnvVars = java.lang.System.getenv("VCAP_SERVICES");
if (json... |
f0a1f1be-8a90-4f7b-8203-9788595be88f | 5 | public static void merge(Comparable[] a, int lo, int mid, int hi) {
int i = lo, j = mid + 1;
for (int k = lo; k <= hi; k++) {
aux[k] = a[k];
}
for (int k = lo; k <= hi; k++) {
// ߵԪþȡұߵԪ
if (i > mid) {
a[k] = aux[j++];
}
// ұߵԪþȡߵԪ
else if (j > hi) {
a[k] = aux[i++];
}
// ҰߵĵǰԪ... |
51da68c5-9c60-4fdf-b3fa-aba841c67b28 | 3 | public Group setClasses(HashMap<Field, Time> aClasses) {
//System.out.println("Group.setClasses() : " + this + " " + aClasses);
if (aClasses != null)
this.classes = aClasses;
for (Field f : this.classes.keySet())
if (!this.done.containsKey(f))
this.done.put(f, false);
return this;
} |
9a0d6353-1ad9-4dcd-a3ae-fcaa86e285fa | 2 | public ArrayList<String> initialize(ArrayList<String> subordinatingConjunctions){
Scanner scanner = null;
try {
scanner = new Scanner(new File("subordinating conjunctions")).useDelimiter(",");
} catch (FileNotFoundException e) {
}
while (scanner.hasNextLine()) {
subordinatingConjunctions.ad... |
8fb76c3d-36de-4a33-802a-a4810041acf2 | 0 | public SortMode(boolean sortUp, int sortMode) {
this.sortUp = sortUp;
this.sortMode = sortMode;
} |
1071da35-553f-4230-82f9-3e3ce7106fe8 | 4 | public MowerCommandListStringAdapter(final String mowercommandList) throws UnrecognizedCommandException {
super(null);
LinkedList<MowerCommand> mowerCommands = new LinkedList<MowerCommand>();
for (int i =0;i<mowercommandList.length();i++){
char command = mowercommandList.charAt(i);
switch(command){
... |
f8ccbcd8-d55e-4b60-95e5-56f6f99c45f8 | 2 | @Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == configButton || e.getSource() == okButton) {
// hides the config dialog
parent.configAction.tap();
}
} |
34870c11-d320-4183-88d8-78c88372783f | 4 | public static List<ContainerData> parseXmlFile(String path) {
try {
// Create a DocumentBuilderFactory
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
// Create a list to store the container data
List<ContainerData> containers = new... |
68134d72-8441-4f58-aabe-210169b614a0 | 9 | public int[] search (ASEvaluation ASEval, Instances data)
throws Exception {
double best_merit = -Double.MAX_VALUE;
double temp_merit;
BitSet temp_group, best_group=null;
if (!(ASEval instanceof SubsetEvaluator)) {
throw new Exception(ASEval.getClass().getName()
... |
aaff9c9a-9e18-4337-90b9-b97a75e1f4d7 | 8 | public static void main(String args[]) throws Exception
{
final int TOP = 200;
String outputPath = "C:/z-ling/task/HEY/ResultTest/AccuracyResult_"+TOP+".txt";
FileOutputStream fos=new FileOutputStream(outputPath);
OutputStreamWriter osw=new OutputStreamWriter(fos);
BufferedWr... |
416498c5-8dc1-4b00-9138-412f6bdcb9b5 | 3 | public void updateMobs(){
for(int i = 0; i < items.size(); i++){
items.get(i).update();
}
for(int i = 0; i < mobs.size(); i++){
mobs.get(i).update();
}
for(Player e : players){
e.update();
}
} |
cfb50397-a1f5-4990-9790-4f3db290860c | 0 | public int getValue() {
return value;
} |
e5524145-e781-4b53-87b7-cd5832bc359a | 9 | protected boolean checkYObstacle(CommonObject so, double time, int halfOfWidth) {
if ((this.currentCoord.getY() + this.currentHeight + currentVerticalSpeed * time >= so.getCurrentCoordinates().getY())
&& (this.currentCoord.getY() + this.currentHeight <= so.getCurrentCoordinates().getY())
... |
6e1f8b5d-5473-4cf7-9922-05f913df9a6d | 9 | public static boolean kickClient(Player player, Client adminClient, boolean banUser, boolean banUserAndMac) {
boolean kik = GameManager.kickClient(player.getName(), adminClient);
if (kik == false) {
Client kickedClient = null;
synchronized(clients) {
for (Client client : clients) {
if (client.getPlay... |
613c26ce-8d0b-4626-9daf-863cbc232a6f | 4 | public static void main( String args[] ){
MiniDB db = new MiniDB( "minidb" );
BufMgr bm = db.getBufMgr();
int size = 8;
BPlusTree bpt = null;
try{
bpt = db.createNewBPlusTreeIndex( "table", "val", 8 );
int iters = 50;
MiniDB_Record insertedRecords[] = new MiniDB_Record[iters];
... |
9f9d7c3c-2043-45f1-9836-6e84d3d5e8d4 | 4 | private void loadLandPolygons(String file, final HashMap<Integer, GMTShape> landPolygons) {
GMTParser gmtpLandPolygons = new GMTParser() {
@Override
public void processShape(GMTShape shape) {
if (shape.getxPoly().length > 0) {
landPolygons.put(shape.ge... |
83e4a6ae-a088-4db9-b3d2-48d02eec7515 | 3 | public void setLineWidth(float lineWidth) {
// Automatic Stroke Adjustment
if (lineWidth <= Float.MIN_VALUE || lineWidth >= Float.MAX_VALUE ||
lineWidth == 0) {
// set line width to a very small none zero number.
this.lineWidth = 0.001f;
} else {
... |
aca90103-1a91-491a-8939-5e166ec7ef9c | 4 | public void loadRawData() {
File f = window.showOpenDialog(new FileNameExtensionFilter("Text files", "txt"));
if (f == null) return;
StringBuilder fileStringBuilder = new StringBuilder();
try {
BufferedReader fr = new BufferedReader(new FileReader(f));
String line;
while ((line = fr.readLine()) != null... |
2b61ddb3-da8e-4054-bd49-b9f87b41028a | 9 | static public BigDecimal atan(final BigDecimal x)
{
if ( x.compareTo(BigDecimal.ZERO) < 0 )
{
return atan(x.negate()).negate() ;
}
else if ( x.compareTo(BigDecimal.ZERO) == 0 )
return BigDecimal.ZERO ... |
eae2707e-4e53-45af-98fc-937feac19e70 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Movie other = (Movie) obj;
if (movieId != other.movieId)
return false;
if (title == null) {
if (other.title != null)
return false;
... |
363fae5a-f6ac-4d48-8264-33999df46dc6 | 9 | public static Vector xmlRead(String fileName)
{
SAXBuilder builder = new SAXBuilder();
Vector pointsList = new Vector();
try
{
Document doc = builder.build( fileName ); // parse XML tags
Element root = doc.getRootElement(); // get root of XML tree
... |
32a8eeca-48b3-424e-8eb6-1133c5c90b94 | 1 | private void loadInfo(ResultSet result){
try{
result.next();
start = result.getString("cas_startu");
end = result.getString("cas_konce");
}catch(SQLException se){
//Handle errors for JDBC
se.printStackTrace();
}
... |
4f73f0f1-e76d-4b53-9ac8-94bb84ed76f9 | 7 | public JSONObject createDomain(
String mode,
String domain,
String group,
String rname,
String[] ns,
String primary_wildcard,
String primary_wildcard_qtype,
String default_mx) {
StringBuilder uriBuilder = new StringBuilder("/api/createDomain/?") ;
uriBuilder.append("AUTH_TOKEN="+apiToken) ;
... |
4ed9e5ff-56fa-42a5-91a2-55c4fe1f7c55 | 8 | void output(int code, OutputStream outs) throws IOException {
cur_accum &= masks[cur_bits];
if (cur_bits > 0)
cur_accum |= (code << cur_bits);
else
cur_accum = code;
cur_bits += n_bits;
while (cur_bits >= 8) {
char_out((byte) (cur_accum & 0xff), outs);
cur_accum >>= 8;
cur_bits -= 8;
}
... |
6c2228b7-8b6e-4186-9703-b2d5ac5cd415 | 7 | private void LoadSavedBill(){
if(ComboBox_SaveBill.getItemCount() > 0){
int idxFile = ComboBox_SaveBill.getSelectedIndex();
String loadFile = saveBillFile + idxFile;
int count = 1;
clear_Paid_list();
clear_table(dm_hoa_don);
try{
... |
45c760d6-a67d-47fa-85f2-b5aa045afd19 | 4 | private boolean abortRequest(Request request) {
// Presumption : transaction exists
transactionEntity tempT = this.transInfo.get(request.transaction);
// remove all transaction requests in the waiting list.
Set<Request> removing = new HashSet<Request>();
for (Request wait : thi... |
54e8db38-f4f2-4b6e-b074-b75ec9e9d342 | 0 | public void setDepartmentId(int departmentId) {
this.departmentId = departmentId;
} |
29f76aad-704a-4aee-a44f-0ac0784cda75 | 6 | public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof TalenPerLandPK)) {
return false;
}
TalenPerLandPK other = (TalenPerLandPK) o;
return true
&& (getLandCode() == null ? other.getLandCode() == null : getLandCode().equals(other.getLandCode()))
&& (getTaalCode() ==... |
64f5a6de-8c17-4b4f-a436-114fc56ef3cb | 4 | static double dot(svm_node[] x, svm_node[] y)
{
double sum = 0;
int xlen = x.length;
int ylen = y.length;
int i = 0;
int j = 0;
while(i < xlen && j < ylen)
{
if(x[i].index == y[j].index)
sum += x[i++].value * y[j++].value;
else
{
if(x[i].index > y[j].index)
++j;
else
++i;
... |
972daf0b-7479-41b6-b1f9-41ebb115a19f | 6 | public String strStr(String haystack, String needle) {
if (needle.isEmpty())
return haystack;
if (haystack.isEmpty())
return null;
int m = 0; // the beginning of the current match in haystack
int i = 0; // the position of the current character in needle
int[] T = kmpTable(needle);
while (m + i < hay... |
52b54b00-c26d-4e37-b833-d2b84eb3012e | 3 | public void resetDemo()
{
entities.removeAll(Entity.class);
createBorders();
for (int i = 0; i < 10; i++)
createAndPositionToFreeSpot(new Ball());
for (int i = 0; i < Const.cheeseamount; i++)
createAndPositionToFreeSpot(new Cheese());
... |
2cf77880-2d8a-46ec-a36b-44970c35fec1 | 7 | public static boolean isReservedOr(String candidate) {
int START_STATE = 0;
int TERMINAL_STATE = 2;
char next;
if (candidate.length()!=2){
return false;
}
int state = START_STATE;
for (int i = 0; i < candidate.length(); i++)
... |
48efe2a7-f429-46cb-8847-25f72aa229b6 | 9 | static final void method129(int i, int i_0_, long[] ls, int i_1_,
int[] is) {
do {
try {
anInt89++;
if ((i ^ 0xffffffff) > (i_1_ ^ 0xffffffff)) {
int i_2_ = (i_1_ + i) / 2;
int i_3_ = i;
long l = ls[i_2_];
ls[i_2_] = ls[i_1_];
ls[i_1_] = l;
int i_4_ = is[i_2_];
is... |
6563f490-2a7c-412b-a81f-1a8b6ed429fa | 4 | private void addDeclination( String root, Properties props, int count ) {
for( int i = 1; i <= count; i++ ) {
String declination = props.getProperty( String.valueOf( i ) );
if( declination == null ) {
return;
}
declination = declination.replace( "{... |
3d1993f3-dfe5-441a-90fc-f74f5eaf48d9 | 7 | private void checkAndUpdateWeapon() {
TouchableRectangle.direction dir;
for (int i = 0; i < bricks.size() && weapon != null; i++) {
Brick br = bricks.get(i);
if ((dir = br.touches(weapon)) != Brick.direction.NONE) {
Dropping temp = br.dropping;
if... |
54528e21-c75a-4477-8437-5b5bc1974112 | 4 | @Override
public void run() {
//Go on while run is true
while(run.get()) {
try {
TFTPPacket packet = packetQueue.take();
if(packet instanceof WRQPacket){
sendFile((WRQPacket) packet);
}e... |
ecb7a88e-3f61-414c-9ea4-cf88fdbd3380 | 2 | public SkiPass getSecondHalfDaySkiPass(Date currentDate) {
if (currentDate == null) {
throw new IllegalArgumentException("Current date is null");
}
Calendar calendar = new GregorianCalendar();
calendar.setTime(currentDate);
calendar.set(Calendar.HOUR_OF_DAY, 13);
... |
1aa998e2-f2e8-4d19-b6ab-d764d57a70ab | 5 | private void analyzeImage(BufferedImage image) {
setProgress("Analyzing...");
worker = new PatchFinder(
image,
controller.getParametersBean().getTolerance(),
40 // TODO parameter
);
worker.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyC... |
fd730c45-b7dc-4acc-b179-efa6f92ec88f | 5 | public String getAnswer(){
for(int a = 1; a < 1000; a++)
for(int b = 1; b < 1000; b++)
for(int c = 1; c < 1000; c++)
if(a + b + c == 1000 && Math.pow(a, 2) + Math.pow(b, 2) == Math.pow(c, 2))
return String.valueOf(a * b * c);
return null;
} |
075451c7-d022-4807-a060-08ddb2337c02 | 7 | private void initComponents() {
//Components
menuBar1 = new JMenuBar();
mFile = new JMenu();
mF1 = new JMenuItem();
mF2 = new JMenuItem();
mF3 = new JMenuItem();
mF4 = new JMenuItem();
mF5 = new JMenuItem();
mEdit = new JMenu();
mE1 = new ... |
03f991ab-fe28-4747-a246-a761751fa4fa | 8 | public void merge(int[] A, int m, int[] B, int n) {
int countA = m - 1;
int countB = n - 1;
for(int i = n + m - 1; i >= 0; --i){
if(countA >= 0 && countB >= 0 && A[countA] > B[countB]){
A[i] = A[countA];
countA--;
continue;
}
if(countA >= 0 && countB >= 0 && A[countA] <= B[countB]){
A[i] ... |
8f971665-d200-488e-8a09-ecd0471cdacc | 9 | public void onDeath(DamageSource par1DamageSource)
{
Entity var2 = par1DamageSource.getEntity();
if (this.scoreValue >= 0 && var2 != null)
{
var2.addToPlayerScore(this, this.scoreValue);
}
if (var2 != null)
{
var2.onKillEntity(this);
... |
8af59a62-cfd8-4a08-8879-56a3a5d2be20 | 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... |
22c7f1ac-c301-46df-94c5-7af295502a3c | 6 | private void generateRoom()
{
int regionHeight = y2 - y1 - 2;
int regionWidth = x2 - x1 - 2;
// Muodostetaan huoneen mitat siten, että mitat ovat vähintään ROOM_MIN_SIZE tai satunnaisesti niin isot kuin mahtuu
int roomWidth = (regionWidth == ROOM_MIN_SIZE) ? ROOM_MIN_SIZE : ... |
e83b4cae-58d6-4cd5-b8d5-e0f57dd78279 | 6 | public void run() {
Process p = null;
try {
if(game.GetOS.isWindows())
p = Runtime.getRuntime().exec("XboxControllerInputConsole.exe");
if(game.GetOS.isUnix() || game.GetOS.isMac())
p = Runtime.getRuntime().exec("./xboxdrv.sh");
} catch (... |
34e7bcc6-9249-4340-8360-2ea68bd0f0cc | 1 | public void setMinBill(double minBill) {
if(minBill < 0) {
throw new IllegalArgumentException(
"error: bill minimum must be greater than or equal to zero");
}
this.minBill = minBill;
} |
28d316c5-8198-42c7-8e5b-b1678fb85160 | 7 | private void addTextContent(Element parent, TextObject textObj) /*throws XMLStreamException*/ {
if ( (textObj.getText() == null || textObj.getText().isEmpty())
&& (textObj.getPlainText() == null || textObj.getPlainText().isEmpty()))
return;
Element textEquiv = doc.createElementNS(getNamespace(), Defaul... |
dcabcf56-17a2-41da-a2db-1c4f7e6c97d7 | 6 | private void sortForward(int par1)
{
PathPoint var2 = this.pathPoints[par1];
float var3 = var2.distanceToTarget;
while (true)
{
int var4 = 1 + (par1 << 1);
int var5 = var4 + 1;
if (var4 >= this.count)
{
break;
... |
34ec36dc-9e64-406b-b43e-5ca8c7ac4f3c | 5 | protected void doMove(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Map<String, Action> actions = getActions();
if (request.getParameter("action") != null){
if(actions.containsKey(request.getParameter("action"))){
if (actions.get(request.getParamete... |
9d9b1883-7d6e-47d2-bec1-43f6ebfef84e | 4 | public boolean simulateInput(String input) {
/** clear the configurations to begin new simulation. */
myConfigurations.clear();
Configuration[] initialConfigs = getInitialConfigurations(input);
for (int k = 0; k < initialConfigs.length; k++) {
FSAConfiguration initialConfiguration = (FSAConfiguration) initia... |
edd67bbb-189e-4fcd-958f-905f096fd8f9 | 3 | @SuppressWarnings("deprecation")
public static boolean UserInputs() {
user = new JTextField(15);
pass = new JPasswordField(15);
JPanel myPanel = new JPanel();
myPanel.add(new JLabel("Username:"));
myPanel.add(user);
myPanel.add(Box.createHorizontalStrut(15)); // a spacer
myPanel.add... |
0df44683-0f23-4290-89c6-0b7d2ee18451 | 1 | @Override
protected Budget createBudget(String budget_choice) throws Exception {
validateBudgetChoice(budget_choice);
return (budget_choice.equals(ANNUAL_BUDGET)) ?
new AnnualBudget("Annual budget", new BigDecimal(BigInteger.ZERO), new Date()) :
new MonthlyBudget("M... |
a19fb452-f1a5-4800-a408-a63077be5ea9 | 5 | public static String[][] translator(String textmap) {
int xSize;
int ySize;
String[][] stringMapArray = null;
//first we need to check that the map is legitimate by calling mapchecker.
if (mapchecker(textmap)) {
try {
//Initiate a buffered reader to read form the file
BufferedReader reader = new Bu... |
b9954591-508b-4a38-ab98-f552e7d37069 | 0 | public PhpposItemsEntity getItemPos(int idItemPos){
return (PhpposItemsEntity) getHibernateTemplate().get(PhpposItemsEntity.class, idItemPos);
} |
3dac1481-5663-47c6-9052-abc973d9410b | 5 | public void actionPerformed(ActionEvent e) {
if (e.getSource().equals(genPoints)) {
int w = graphPanel.getWidth();
int h = graphPanel.getHeight();
pRadius = Utils.scaledPointSize(numPoints, w, h);
myGraph.reset();
resetPath();
myGraph.addNodes(Utils.genPoints(numPoints, w, h), w,... |
43015011-4999-4246-9a58-9e9c01227045 | 6 | private final void method2849(int i, int i_39_, byte i_40_, int i_41_) {
anInt8941++;
Class348_Sub43 class348_sub43
= aClass348_Sub43ArrayArray8928[i_41_][i_39_];
if (class348_sub43 != null) {
int i_42_ = -123 % ((i_40_ - 24) / 42);
aClass348_Sub43ArrayArray8928[i_41_][i_39_] = null;
if ((((Class... |
7c441542-9b58-4e7e-b653-159ce1e08304 | 0 | public void setSucc(DoublyLinkedNode succ) {
this.succ = succ;
} |
b2fc428c-d02d-4a54-954e-1eac511b190f | 6 | public int next_note( int data_offset, int[] note ) {
int bitmask, field;
if( data_offset < 0 ) {
data_offset = pattern_data.length;
}
bitmask = 0x80;
if( data_offset < pattern_data.length ) {
bitmask = pattern_data[ data_offset ] & 0xFF;
}
if( ( bitmask & 0x80 ) == 0x80 ) {
data_offset += 1;
}... |
cefa43cb-2134-469f-8295-67562fc62655 | 7 | public void reconnectRejectPart() {
for (Transition t : rejectPartBridges) {
boolean add = false;
if (t.getType() == Derive.class) {
if (items.contains(t.source)) {
add = true;
t.source.derives.add(t);
}
} else { // t is a Reduce
if (items.contains(t.target)) {
add = true;
t.s... |
5e87c625-d11b-4900-925f-a4afabc0b30b | 9 | protected boolean balancedJSToken() {
Deque<Character> stack = new ArrayDeque<Character>();
while (true) {
int c = input.read();
if (stack.isEmpty() && c == '`') {
return true;
}
if (!stack.isEmpty() && stack.element() == c) {
... |
01e6e76f-a413-456d-8f3c-9768fb292469 | 7 | int pack_books(Buffer opb){
opb.write(0x05, 8);
opb.write(_vorbis);
// books
opb.write(books-1, 8);
for(int i=0; i<books; i++){
if(book_param[i].pack(opb)!=0){
//goto err_out;
return (-1);
}
}
// times
opb.write(times-1, 6);
for(int i=0; i<times; i++){
... |
836cf9f3-4d40-412d-bd56-d27e23aa00b3 | 0 | @After
public void tearDown() {
} |
24a1d8de-fff8-4163-8499-142dca3817f2 | 0 | public void setNumUndo(int nn){
numUndo = nn;
} |
be658b87-b0cf-4085-b82d-4d00f3026061 | 9 | public String longestCommonPrefix(String[] strs) {
int n = strs.length;
if(n==0){
return "";
}
if(n==1){
return strs[0];
}
if(strs[0] == ""){
return "";
}
int i;
for (i = 0;i<strs[0].length();i++){
fo... |
e34fbf88-ea15-4209-95c4-4a384129e83e | 0 | public Context(State state) {
this.state = state;
} |
12e784f1-cf83-4762-bc54-6403884c5fc8 | 7 | private Tuple<Float, HeuristicData> max(LongBoard state, HeuristicData data, float alpha,
float beta, int action, int depth) {
Winner win = gameFinished(state);
statesChecked++;
Tuple<Float, HeuristicData> y = new Tuple<>((float) Integer.MIN_VALUE, nul... |
8d4a1989-2f08-49c7-bd30-fc69cf386bfd | 0 | public void harvest(int quantity, Villager villager)
{
resources -= quantity;
villager.getProffession().setRsrceQuantity(villager.getProffession().getRsrceQuantity() + quantity);
} |
87c9abbc-e68b-4445-be77-0dc740059e67 | 5 | public void reduceAP(MapleClient c, byte stat, short amount) {
MapleCharacter player = c.getPlayer();
switch (stat) {
case 1: // STR
player.getStat().setStr(player.getStat().getStr() - amount);
player.updateSingleStat(MapleStat.STR, player.getStat().getStr());... |
43e73baa-1de0-4da5-95fb-9a705f425c8a | 5 | public static void main(String[] args)
{
//Symmetric case
sc = new Scanner(System.in);
System.out.println("enter the number of Channels");
m = sc.nextInt();
System.out.println("m is " + m + " and 2m-1 is " + (2 * m - 1));
// forming array with channels starting from 1 to c
arr = new int[2 * m - 1];
fo... |
213814d9-4613-4f83-838d-115e07ab1032 | 2 | public static void readAppletParams(java.applet.Applet applet) {
VoidParameter current = head;
while (current != null) {
String str = applet.getParameter(current.getName());
if (str != null)
current.setParam(str);
current = current.next;
}
} |
4bb7d3c7-d213-4a77-bdd7-2ecca183d341 | 0 | @Override
public void addNews(News news) {
allNews.add(news);
updateAll();
} |
fe3138dd-9a3d-495c-82eb-444fddb2bcf4 | 4 | private int getAdjacentTracks() {
int var1 = 0;
if (this.isMinecartTrack(this.trackX, this.trackY, this.trackZ - 1)) {
++var1;
}
if (this.isMinecartTrack(this.trackX, this.trackY, this.trackZ + 1)) {
++var1;
}
if (this.isMinecartTrack(this.trackX... |
79cc8278-5128-4d4e-96b7-00db0367030d | 2 | public boolean equals(Object toCompare)
{
if(toCompare instanceof Quantity)
{
if(this.toString().equals(toCompare.toString()))
return true;
}
return false;
} |
99125536-a7fd-4fc5-94a2-20b9f498fc7c | 4 | @Override
public Object[] getData()
{
if (ptr != 0) {
return null;
} else {
if (isConstant()) {
if (length > getMaxSizeOf32bitArray()) return null;
Object[] out = new Object[(int) length];
for (int i = 0; i < length; i++) {
... |
effef3d3-531e-4358-b8e4-2e5b7dc159b0 | 4 | public static <T> ArrayList<T> array_values(Map<?, T> m) {
// OK
ArrayList<T> output = new ArrayList<T>();
if (m == null) return output;
int i = 0;
synchronized(m) {
for (Map.Entry<?,T> entry : m.entrySet()) {
T value = entry.getValue();
output.add(i,value);
i++;
}
}
return output;
} |
8264430c-bca6-4c71-bccd-d73ffe3cd2e7 | 4 | private void CreateKeyButtons(Keyboard keyboard) {
KeysPanel.removeAll();
KeysPanel.setLayout(new FlowLayout());
if (!keyboard.getMapOfKeys().isEmpty()) {
for (char key : keyboard.getMapOfKeys().keySet()) {
// "" + key
final JToggleButton keyButton = n... |
67db0354-c9d4-407c-8e14-fba50c1bdd18 | 2 | public void send(String groupName, Message message) {
message.setSeqNum(this.groupSpg.get(groupName));
this.groupRpg.groups.get(groupName).put(this.localHostName, this.groupSpg.get(groupName));
this.groupSpg.put(groupName, this.groupSpg.get(groupName) + 1);
//this.messagePasser.getTimeStamp().addClock();
... |
c10c34d5-9029-47d5-86a1-81bceb46a543 | 9 | public Model method209(int arg0, int arg1, boolean flag) {
Model model;
if (flag) {
model = getModel(anInt255, anInt256);
} else {
model = getModel(anInt233, mediaId);
}
if (model == null) {
return null;
}
if (arg1 == -1 && arg0 == -1 && model.triangleColors == null) {
return model;
}
Mode... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.