method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
ffa3c95a-3c11-4f00-ac84-5cd262ed4df3 | 5 | final void _parseName_() {
final int start = this.index();
for (int symbol = this.skip(); symbol >= 0; symbol = this.skip()) {
if (symbol == '>') {
if (this.skip() != '>') {
this._put_('!', start);
return;
}
} else if (symbol == '<') {
if (this.skip() != '<') {
break;
}
}
}... |
2f493c21-ab63-4c2b-b691-8ce88d29a381 | 0 | @Override
public void execute(VirtualMachine vm) {
vm.setRunning(false);
} |
5e37f6df-168d-4c77-ae4e-2ac29be89940 | 9 | public void moveToLocation (Location newLocation) {
try {
newLocation.add(this);
}
catch(Exception e) {
}
currentLocation = newLocation;
if(newLocation instanceof Hangar) {
this.status = waitingToDepart;
}
else if(newLocation instanceof Workshop) {
this.status = beingRepaired;
}
... |
44e29d56-53a2-4f43-aa89-9459d90eb555 | 6 | public Node lowerNode(T k) {
Node x = root;
while (x != NULL) {
if (k.compareTo(x.key) >0) {
if(x.right != NULL){
x = x.right;
}else{
return x;
}
} else {
if(x.left != NULL){
x = x.left;
}else{
Node current = x;
while(current.parent !=... |
402f91f6-42d6-4f7e-a5c1-9c91d3a15885 | 2 | @Override
public boolean equals(Object o)
{
FlipHash other = (FlipHash)o;
return other.cursorX == cursorX &&
other.cursorY == cursorY &&
other.board.equals( board );
} |
b5404c5f-f307-4638-b1a5-2b02feaaa5f7 | 1 | public void displayTree()
{
if (this.isLeaf()) {
System.out.print("(" + this.caractere + ":" + this.poids + ")");
}
else {
System.out.print("(");
this.fGauche.displayTree();
this.fDroit.displayTree();
System.out.print(")");
... |
07696100-4e8a-49cd-84f2-7ba53ed733f8 | 2 | public void UpdateDep(Departamento DEP) throws SQLException, excecaoDepartamento {
DepartamentoDAO depDAO = new DepartamentoDAO();
Departamento DepExistente = null;
DepExistente = depDAO.selectDepartamentoPorNome(DEP.getNome());
if (DepExistente == null || DepExistente.getCodigo().equ... |
50dd3cd9-2c45-411a-808b-1122f1f92981 | 4 | private Player resultSetToPlayer(ResultSet rs) throws SQLException {
Player player = new Player();
player.setId(rs.getLong("id"));
player.setName(rs.getString("name"));
player.setSurname(rs.getString("surname"));
player.setPlayerNumber(rs.getByte("number"));
player.setTea... |
cb247045-1121-4faf-9ff5-cc04ccd4ba2b | 6 | public boolean rendre(Emprunt emprunt) throws Exception {
boolean retour = false;
if (emprunt.getLivre() == null) {
throw new NullPointerException("Livre null !");
}
if (emprunt.getAdherent() == null) {
throw new NullPointerException("Adhérent null !");
}
... |
0abe0dab-3c88-4455-b1fd-4af7d18d158a | 5 | private void updateHistogram(ArrayList<Chord> chords) {
Chord prev, next;
for(int i=0; i<chords.size()-1; i++){
prev = chords.get(i);
next = chords.get(i+1);
String previousChord = prev.toString();
String nextChord = next.toString();
if(!chordList.containsKey(previousChord)){
chordList.put(previ... |
b46ac528-2d5d-47a7-9e01-44e36e4fa7e0 | 9 | @Override
public int actionOnBoard(Territory territory, int player){
if(victory){
if(territory.getFamily()==model.getFamily(player) && territory.getTroup()!=null && territory.getTroup().getTroops()[1]>0){
territory.getTroup().addToop(0, 0, 1, 0);
territory.getTroup().rmToop(0, 1, 0, 0);
numberKnight[0... |
a8ddcb61-2356-44a3-98ae-b2dd82a99921 | 7 | protected Operation [] getOptimalOperations(BayesNet bayesNet, Instances instances, int nrOfLookAheadSteps, int nrOfGoodOperations) throws Exception {
if (nrOfLookAheadSteps == 1) { // Abbruch der Rekursion
Operation [] bestOperation = new Operation [1];
bestOperation [0] = getOptimalOperatio... |
be9c43d0-3487-4bff-9854-e74a52cd5fa4 | 5 | private void forecastGridlet()
{
// if no Gridlets available in exec list, then exit this method
if (gridletInExecList_.size() == 0) {
return;
}
// checks whether Gridlets have finished or not. If yes, then remove
// them since they will effect the MIShare calcul... |
367a0e58-6891-4255-8949-d64f80290efb | 7 | public static HSSFWorkbook html2Excel(HSSFWorkbook wb, Html html, int i)
throws Exception {
HSSFSheet sheet = wb.createSheet(html.getHead().getTitle().getElementText());
// sheet.setColumnWidth(5,14*36);
Style htmlStyle = html.getHead().getStyle();
Table htmlTable = html.getBody().getTable();
List<CellRa... |
99ee424e-5c1c-4eb2-ad10-12ef71c81393 | 2 | public static void main(String[] args) throws FileNotFoundException {
Data d = Reader.getDataFromFile(new File("files/restaurant2.arff"));
int size = d.getAttributes().size();
Random r = new Random();
for (int i = 0; i < 100; i++) {
ArrayList<String> row = new ArrayList<String>();
for (int j = 0... |
eb117129-213f-4246-a298-bea88a1c8622 | 9 | private void resize() {
width = getSkinnable().getWidth();
height = getSkinnable().getHeight();
if (getSkinnable().isKeepAspect()) {
if (aspectRatio * width > height) {
width = 1 / (aspectRatio / height);
} else if (1 / (aspectRatio / height) > width) {
... |
5b662d17-010b-4e22-b89d-2f14713d032f | 3 | private static CtMethod delegator0(CtMethod delegate, CtClass declaring)
throws CannotCompileException, NotFoundException
{
MethodInfo deleInfo = delegate.getMethodInfo2();
String methodName = deleInfo.getName();
String desc = deleInfo.getDescriptor();
ConstPool cp = declarin... |
0d99fab6-3c53-4558-9286-f4182a3ac829 | 1 | public void paintComponent(Graphics g) {
super.paintComponent(g);
if(image != null){
g.drawImage(image, 0, 0, getWidth(), getHeight(), null);
}
} |
9ff14267-6c3d-4d24-8328-8db023789e82 | 9 | public void computeWords2(String spelling) {
String[] segmentedSpelling = segment(spelling).split(" ");
String[] seg = segmentedSpelling;
ArrayList<String> waitingSentence = new ArrayList<String>();
ArrayList<Integer> waitingCount = new ArrayList<Integer>();
char[] firstWords = findWaitingWords(seg[0]).toCha... |
7493e0d0-467e-497b-bc92-97e5f713c329 | 1 | public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
for (FiguraGeometrica d : objetos) {
d.desenhar(g2);
}
} |
8a611e89-0ac1-45c2-8e4e-f3e03e874b76 | 1 | private int evalState(State s) {
int score = evalStateSide(s, "red") - evalStateSide(s, "blue");
return (me == "red")?score:-score;
} |
a68624eb-a2ca-471c-a8ad-6c23970cc3fd | 1 | public static String getPage(CommandParameter commandParameter) {
String pageName = null;
if (commandParameter.getRequestURI().contains(FrontController.HOME_PAGE.replace("jsp", "ctrl"))) {
return commandParameter.getContextPath() + "/" + FrontController.HOME_PAGE;
}
pageName = commandParameter.get... |
00f721cf-cb08-4464-a32e-11d0e93fa7f9 | 3 | public static final String convertColorNameToRGB(String name) {
int c = convertNamedColor(name.toLowerCase());
if (c >= 0) {
//int rgb = c.getRGB();
char[] buf = new char[7];
buf[0] = '#';
for (int pos = 1, shift = 20; shift >= 0; ++pos, shift -= 4) {
... |
fa5d422d-ec4a-4ee0-9430-a27958079f21 | 8 | static public ParseException generateParseException() {
jj_expentries.clear();
boolean[] la1tokens = new boolean[24];
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 19; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
... |
78824c28-d4f5-4174-8d96-05f41ce363fc | 6 | public FSList getAnnotationsFromChapter(FsNode chapter) {
if (chapter != null) {
if (this.annotations == null) {
System.out.println("getting annotations");
getAnnotations();
}
FSList annotations = new FSList("chapter/"+chapter.getId());
float start = chapter.getStarttime();
float durati... |
5798b605-d8d7-4ea4-bca7-618ece073ae3 | 9 | public static void main(String[] args) {
if (args.length != 2) {
System.err.println("Usage: java TextComparer <file name> <file name>");
System.exit(-1);
}
BufferedReader reader1 = null;
BufferedReader reader2 = null;
try {
reader1 = new Buff... |
768863f8-0860-4a2e-9218-7d97bbc69cbe | 5 | public static void main(String[] args) {
try {
QuestionCalculation qcal = new QuestionCalculation();
ArrayList<Integer> opd = new ArrayList<Integer>();
opd.add(12);
opd.add(84);
opd.add(45);
opd.add(90);
ArrayList<Character> opt... |
43738aa3-4845-4ab2-8b75-9959a336eac5 | 8 | int[] getMaxCardOrder(boolean[][] bAdjacencyMatrix) {
int nNodes = bAdjacencyMatrix.length;
int[] order = new int[nNodes];
if (nNodes==0) {return order;}
boolean[] bDone = new boolean[nNodes];
// start with node 0
order[0] = 0;
bDone[0] = true;
// order remaining nodes
for (int iNode = 1; iNode < nNod... |
4b150a7a-ecae-453b-9a0d-f8d6bedaefed | 6 | private void checkMeltdownAdvance() {
if ((! structure.intact()) && meltdown == 0) return ;
float chance = meltdownChance() / World.STANDARD_DAY_LENGTH ;
chance += meltdown / 10f ;
if (isManned()) chance /= 2 ;
if (Rand.num() < chance) {
final float melt = 0.1f * Rand.num() ;
meltdown +=... |
540b361a-7a3d-44e6-9029-5de153a711ba | 3 | public static JSONObject toJSONObject(String string) throws JSONException {
String name;
JSONObject jo = new JSONObject();
Object value;
JSONTokener x = new JSONTokener(string);
jo.put("name", x.nextTo('='));
x.next('=');
jo.put("value", x.next... |
461951c1-fa72-4391-a787-1180bb71ade7 | 6 | @Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Update other = (Update) obj;
if (version == null) {
if (other.version != null) {
return false;
}
} else... |
1fb6dfb8-fa28-4978-89e8-e3e351fac0f9 | 9 | static protected void FillBuff() throws java.io.IOException
{
if (maxNextCharInd == available)
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
else if (tokenBegin < 0)
bufpos... |
3991d170-dffc-4a7d-846c-26be3b00b16a | 1 | public void visit_aaload(final Instruction inst) {
stackHeight -= 2;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 1;
} |
9156fd4d-1ec2-4b94-9084-e9a40dae8b07 | 3 | @Override
public void setEditPane(Contestant c, boolean newContestant) {
GameData g = GameData.getCurrentGame();
tfContID.setEnabled(!g.isSeasonStarted());
if (newContestant || c == null) {
// set default values
tfContID.setText("");
tfFirstName.setText("First Name");
tfLastName.setText("Last Nam... |
f633fe36-ea02-44bb-a797-ed948d5f0acc | 2 | public synchronized void register(Action action) {
if(action instanceof OrderDependentAction || !action.activate(getRemainingTime()))
actions.add(action);
} |
460eab6a-a5bf-4b10-b740-a75b3cbf879a | 5 | private boolean isValidPlayer(Entity entity) {
boolean isValidPlayer = false;
if (entity instanceof Player) {
boolean isNPC = false;
if (plugin.cititzensPlugin != null) {
try {
isNPC = plugin.cititzensPlugin.getDescription... |
e0166e3c-5e17-4e59-9df3-6d6cca9e3993 | 3 | @Override
public FileVisitResult preVisitDirectory(Path pDir, BasicFileAttributes attr) {
if (!pDir.toString().contains(
"dynmap" + System.getProperty("file.separator") + "web")) {// Comment out this if to allow copying of files in a folder called dynmap\web
try {
dirNum++;
if (dirNum > 1) {
Stri... |
f581f12b-5ff4-4264-b288-15e301545001 | 0 | public void setAddressCompany(Address addressCompany) {
this.addressCompany = addressCompany;
} |
22ecc3db-6285-4ea9-a60b-fc92b6f6adad | 0 | public void setWorkingDay(String workingDay) {
WorkingDay = workingDay;
} |
f287df34-2044-4cd5-8b25-f16a4861e4df | 2 | public void improveCity() {
if ( selected.getClass() == Worker.class ) {
Tile tile = selected.getTile();
if ( tile.getCity() != null ) {
((Unit)selected).owner.removeUnit( (Unit)selected );
tile.getCity().Production += IMPROVE_CITY_PRODUCTION;
... |
4c26ff46-81d0-40c9-99cf-d8f2ccd84311 | 7 | public void destroy(String id) throws IllegalOrphanException, NonexistentEntityException, RollbackFailureException, Exception {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
Telecommunications telecommunications;
try ... |
6c4d5453-7371-4e2c-a0bb-5ab49b7e9749 | 8 | protected String toJSONFragment() {
StringBuffer json = new StringBuffer();
boolean first = true;
if (isSetDate()) {
if (!first) json.append(", ");
json.append(quoteJSON("Date"));
json.append(" : ");
json.append(quoteJSON(getDate() + ""));
... |
419c32da-3448-4c17-9bc3-dd5f4ab3dddb | 5 | char[][] getMap() {
char[][] map = new char[activeBoardSize+2][activeBoardSize+2];
for(int i=0; i<map.length; i++) {
for(int j=0; j<map[0].length; j++) {
map[i][j] = ' ';
}
}
for(Fence f:staticFences) {
map[f.getX()][f.getY()] = 'f';
}
for(Fence f:activeFences) {
map[f.getX()][f.getY()] =... |
462de47f-81aa-4353-b0c1-80a0d88fa40a | 8 | public void updatePosition(Level terrain)
{
boolean collision = false;
while (detectHorizontalCollision(terrain) == true)
{
collision = true;
if (heroxSpeed < 0)
{
heroxSpeed = (int)(heroxSpeed + 1);
}
else if (heroxSpeed > 0)
{
heroxSpeed = (int)(heroxSpeed - 1);
}
}
herox += ... |
b5e50b66-0361-496f-b8a8-179616d5a282 | 4 | @Override
public String getTileUrl(int x, int y, int zoom)
{
int ty = y;
int tx = x;
// int width_in_tiles = (int)Math.pow(2,pyramid_top-zoom);
int width_in_tiles = getMapWidthInTilesAtZoom(zoom);
// System.out.println("width in tiles = " + width_in_tiles + " x = " + tx + " y = " + ty);
if (ty < 0)
{
... |
8eee78ff-8705-42c0-9fd3-937364fa219f | 8 | public final Object nextValue() throws JSONException {
char c = nextClean();
String s;
switch (c) {
case '"':
case '\'':
return nextString(c);
case '{':
back();
return new JSONObject(this);
case '[':... |
771431a3-b14d-4f36-9fb6-d310351bc067 | 9 | public static void main(String[] args)
{
Scanner eingabeScanner = new Scanner(System.in);
String[] namen = null;
boolean wiederholen = true;
// do ... while Schleife wird mindestens einmal ausgefuehrt
do
{
System.out.println("Bitte eine Nummer wählen: 1.Erstellen, 2.Suchen oder 3.Anzeigen ");
... |
b87faa73-cd3c-4f25-9364-67b3f9b12fa5 | 8 | public void muteToType(EntityType newType) {
if (type != EntityType.ABSTRACT_CLASS && type != EntityType.CLASS && type != EntityType.ENUM
&& type != EntityType.INTERFACE) {
throw new IllegalArgumentException("type=" + type);
}
if (newType != EntityType.ABSTRACT_CLASS && newType != EntityType.CLASS && newTy... |
158a71cc-5d6a-4261-b686-23d20e2e6dfe | 8 | public void starteSpiel() {
for (int zeile = 0; zeile < spielfeld.length; zeile++) {
for (int spalte = 0; spalte < spielfeld[zeile].length; spalte++) {
spielfeld[zeile][spalte] = "[ ]";
}
}
platziereSpieler();
Spieler gewinner = null;
int runde = 0;
GamePrinter.printSpielfeld(spielfeld, spielerR... |
b0374bf7-3b32-48ff-a010-e8eb1169a548 | 0 | public RequestWrapper getRequestWrapper() {
return requestWrapper;
} |
abac285f-7c50-493f-9363-f93d3811fda1 | 3 | private void updateElement() {
try {
SortedMap<String, Object> map = updateElementTableModel.getProperties();
ElementListViewHelper helper = (ElementListViewHelper) updateElementsComboBox.getSelectedItem();
if(helper == null)
return;
NetworkHardware nh = (NetworkHardware) helper.getNetworkHardware... |
deb640b3-a3f8-4503-8b4d-d62e235699d3 | 7 | public static void main(String[] args) {
List<Integer> topList = new ArrayList<Integer>();
for(int j= 1;j<100;j++){
System.out.println("team size = " + j);
for(int i = 1 ; i <= j ;i++){
topList.add(i);
}
if(topList.size() % 2 ==0 && topList.size() %4 !=0){
int size = topList.size();
int f1 = to... |
602a13f6-f30b-4070-9e31-30e76dc14275 | 4 | public void processVideo() throws Exception {
if (converterThread != null && converterThread.isAlive()) {
throw new Exception("Convert is already running");
}
if (videoInputPath == null) {
throw new Exception("Video input is not specified.");
}
if (video... |
a4eed87b-fe3e-46ba-961a-20af9739e2cc | 6 | private void menuItemSaveAsActionPerformed(ActionEvent evt)
{
JFileChooser fc = new JFileChooser();
fc.setAcceptAllFileFilterUsed(false);
fc.setFileFilter(new FileFilter()
{
public boolean accept( File f )
{
return f.isDirectory() || f.getName().toLowerCase().endsWith(".ser");
}
public String... |
a3c468f6-c271-4ce2-b8ea-be616674e787 | 5 | public static void main( String[] argv ) {
try {
String filename;
String stopMark;
if( argv.length >= 1 ) filename = argv[0];
else filename = "document_root_alpha/example.POST_DATA.txt";
if( argv.length >= 2 ) stopMark = argv[1];
else stopMark = "--... |
68fa3fe5-168f-46f7-ab0b-6a4b2ccd3ad1 | 3 | public void render() {
RoofObject[][] SubArea = getVisibleMap(Screen.getPlayer());
for (int x = 0; x < SubArea.length; x++) {
for (int y = 0; y < SubArea[0].length; y++) {
if (!(SubArea[x][y] == null))
renderObject(x, y, SubArea[x][y]);
}
}
} |
d89c9852-c81a-4ed5-a261-35178f4c69ca | 5 | public static void setPlayerAFK( String player, boolean sendGlobal, boolean hasDisplayPerm ) {
BSPlayer p = getPlayer( player );
if ( !p.isAFK() ) {
p.setAFK( true );
if ( sendGlobal ) {
sendBroadcast( Messages.PLAYER_AFK.replace( "{player}", p.getDisplayingName()... |
00e3ef36-bc5e-4920-a7fe-54b23ed3f5ef | 5 | private static int count(String filename) throws IOException {
InputStream is = new BufferedInputStream(new FileInputStream(
filename));
try {
byte[] c = new byte[1024];
int count = 0;
int readChars = 0;
boolean empty = true;
while ((readChars = is.read(c)) != -1) {
empty = false;
for (in... |
41b3bca8-65ea-4e7b-80b4-d029e58b23c7 | 4 | @Override
public void insertString(int offs, String str, AttributeSet a)
throws BadLocationException {
if (str == null) {
return;
}
char[] chars = str.toCharArray();
boolean ok = true;
for (int i = 0; i < chars.length; i++) {
try {
Integer.parseInt(String.valueOf(chars[i]));
} ... |
0cba7349-786e-4649-804d-d1f0585427dc | 4 | public String longestPalindrome_3(String s){// greedy solution
String res = "";
for(int i = 0; i < s.length(); ++i){
String ex = extend(s, i, i);
res = res.length() < ex.length() ? ex : res;
}
for(int i = 0; i < s.length() - 1; ++i){
String ex = extend... |
63ad43f6-8259-406f-b335-8f96b34a58fa | 6 | public Path BestPath(Path p1, Path p2) {
Path output = p1;
if (p1 == null
|| (p2 != null && playerCount != 3 && p2.getAverageWorth() > p1
.getAverageWorth())) {
output = p2;
} else if (p2 != null
&& p2.getAverageWorthNeutral() > p1.getAverageWorth()) {
output = p2;
}
return output;
} |
0ad83106-f570-42f9-8496-cc934fb01f8d | 2 | public PokeSelectWin()
{
this.setTitle("????");
this.setSize(300,400);
this.setResizable(false);
this.setLayout(null);
this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
this.setVisible(false);
visible = false;
this.setLocationRelativeTo(null);
cp = this.getContent... |
deda6008-919c-4c12-a504-6567e109daf7 | 4 | public static String compress(String s) {
if(s.length() <= 1) {
return s;
}
char c = s.charAt(0);
StringBuilder sb = new StringBuilder();
int count = 0;
for(int i = 0; i < s.length(); i++) {
if(c == s.charAt(i)) {
... |
e78391aa-8c27-42c9-b0a4-b9aad901ef62 | 1 | public static ArrayList<String> getPlayerOwnList(String playerUUID) {
ArrayList<String> places = new ArrayList<String>();
if (Spectacles.storedPlayerData == null) {
return places;
} else {
places = Spectacles.storedPlayerData.get(playerUUID);
return places;
... |
bb49d0b4-6ce3-4d91-b769-130610601986 | 4 | AbstractCar(RegistrationNumber registrationNumber, int fuelCapacity, int fuelInCar, boolean carRented){
this.registrationNumber = RegistrationNumber.getInstance(registrationNumber.getLetterIdentifier(), registrationNumber.getNumberIdentifier());
if (RegistrationNumber.getInstance(registrationNumber.getLetterIdenti... |
85e866ee-afdf-40be-a6b7-6c64d8ee9c16 | 6 | private void checkPrintFunction() throws Exception {
if(iterator < tokenList.size() && tokenList.get(iterator++).getType() != TokenType.L_PAR) {
// missing opening parenthesis
throw new Exception("Syntax Error at line " + tokenList.get(iterator-1).getLine() +
": Expected ( and got \"" + tokenList.get(iter... |
199acfe2-1c68-4f9c-b557-9de5443b062b | 6 | public static RealVector solve(RealMatrix A, RealVector y, int k) {
RealVector xest = new ArrayRealVector(new double[A.getColumnDimension()]);
RealMatrix z = A;
RealVector v = y;
int t = 0;
int[] T2=null;
while (t < 100) {
//System.out.println(String.valueO... |
144de27a-62f1-431c-9c1a-83d4c6e2c9d4 | 3 | @Override
public List<Autor> ListByNome(String nome) {
Connection conn = null;
PreparedStatement pstm = null;
ResultSet rs = null;
List<Autor> autores = new ArrayList<>();
try{
conn = ConnectionFactory.getConnection();
pstm = conn.prepareStatement(LIST... |
f2d69030-8016-4956-afa9-c2c246877eeb | 0 | private void swap(Object[] array, int i, int change) {
Object helper = array[i];
array[i] = array[change];
array[change] = helper;
} |
4ba0b29e-969e-447d-904f-9b61754cbf0a | 8 | public void putAll( Map<? extends Long, ? extends Long> map ) {
Iterator<? extends Entry<? extends Long,? extends Long>> it =
map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends Long,? extends Long> e = it.next();
this.put( e.getKey(), e.... |
3bac9cc8-1945-4c8d-9602-3826fe6313bb | 8 | public void draw(GOut g) {
Coord dc = new Coord();
if (drawbg)
for (dc.y = 0; dc.y < sz.y; dc.y += texpap.sz().y) {
for (dc.x = 0; dc.x < sz.x; dc.x += texpap.sz().x) {
g.image(texpap, dc);
}
}
g.chcolor();
int y... |
3bc1c130-5c78-4954-952d-608ac68edbcf | 3 | public void update(GameContainer gc, StateBasedGame sb, int delta) {
Input in = gc.getInput();
if(in.isKeyDown(Input.KEY_L))
{
Mob mob = RPG372.gameInstance.getNearestMob();
if(mob != null){
FightState fs = (FightState)sb.getState(RPG372.FIGHT);
fs.setMob(mob);
fs.setCurrentPlayer(RPG372.gameIns... |
b65356cf-0b7b-42cb-9b32-e7b000ad7b06 | 5 | private void read(Reader reader) throws IOException {
ScanfReader scanReader = new ScanfReader(reader);
try {
doread(scanReader);
} catch (Exception e) {
throw new IOException(e.getMessage() + ", line " + scanReader.getLineNumber());
}
//bulding the constru... |
748cb0e0-4f07-47ba-a449-d3d20eb60083 | 4 | public void findBestSystemEP() {
for (SoftwareSystem softwareSystem : systemsEP)
softwareSystem.refine();
bestSoftwareSystemEP = systemsEP.get(0);
worstSoftwareSystemEP = systemsEP.get(0);
for (SoftwareSystem softwareSystem : systemsEP) {
if (softwareSystem.getSystemConsumptionEP() < bestSoftwareSystemEP.... |
f6106ea2-fd66-4a1a-9d7f-1af0e15e2d06 | 0 | public void syncToGlobal() {
lineEnd.cur = Preferences.getPreferenceLineEnding(Preferences.SAVE_LINE_END).cur;
saveEncoding.cur = Preferences.getPreferenceString(Preferences.SAVE_ENCODING).cur;
saveFormat.cur = Preferences.getPreferenceString(Preferences.SAVE_FORMAT).cur;
ownerName.cur = Preferences.getPreferen... |
7333817d-5f82-44bb-8c4c-c823752477ae | 3 | public void updateEnemies(long time, Game game) {
// Loop through all the available enemies
for(int i = 0; i < enemies.length; i++) {
// Try block for safety.
try {
// If the enemy is alive, then let's update it.
if(enemies[i].living == true) { enemies[i].update(time,game); }
}... |
d946b914-c21d-4218-9640-bf0b58510429 | 4 | public ArrayList<UserTuple> buildFriends(){
ArrayList<UserTuple> friendList = new ArrayList<UserTuple>();;
try {
ResultSet rslSet = dbMgr.executeQuery("select usrid1 from friend where usrid2='"+userId+"'");
if(rslSet !=null)
{
while(rslSet.next()){
ResultSet rslSet1 = dbMgr.executeQuery("select... |
644b7cd7-51d2-44a2-a3c8-aeb7d7439128 | 9 | private static boolean isType(String argument, ArgumentTypes arg)
{
switch(arg)
{
case NUMBER:
{
return isInteger(argument);
}
case QUEUE:
{
try
{
Queue.valueOf(argument);
return true;
}
catch(IllegalArgumentException e)
{
return false;
}
}
case SEASO... |
09b35e79-6b1d-4a27-8aaa-aa87d0fb68f1 | 7 | @Override
public void executeMsg(Environmental host, CMMsg msg)
{
if((msg.target()==affected)
&&((msg.targetMinor()==CMMsg.TYP_LOOK)||(msg.targetMinor()==CMMsg.TYP_EXAMINE))
&&(CMLib.flags().canBeSeenBy(affected,msg.source()))
&&(affected instanceof MOB)
&&((daysRemaining>0)&&(monthsRemaining<=3)))
{
m... |
0321cba6-64fb-4265-80e9-12050b83757e | 8 | public boolean optimize(final int numSteps, final double convergenceDelta) throws InvalidConfigurationException {
if (!configured) {
configure();
}
final int deltaNumSteps = numSteps/10;
final Genotype population = Genotype.randomInitialGenotype(configuration);
final ... |
7a295982-6196-4562-b03e-9c033e577fd5 | 5 | public Wave28(){
super();
MobBuilder m = super.mobBuilder;
for(int i = 0; i < 1000; i++){
if(i % 5 == 0)
add(m.buildMob(MobID.DODRIO));
else if(i % 4 == 0)
add(m.buildMob(MobID.FEAROW));
else if(i % 3 == 0)
add(m.buildMob(MobID.RATICATE));
else if(i % 2 == 0)
add(m.buildMob(MobID.DODUO... |
e4f04831-bcd7-4621-ba55-50acb8672b2e | 5 | public static void fillVacancies(Venue venue) {
//
// We automatically fill any positions available when the venue is
// established. This is done for free, but candidates cannot be screened.
if (venue.careers() == null) return ;
for (Background v : venue.careers()) {
final int numOpen = ve... |
e3eb1402-41ee-46fc-8c36-ae3688aa14b0 | 1 | public static List<String> decodificarError(String errorJSON) {
List<String> resultado = new ArrayList<String>();
JSONParser parser = new JSONParser();
try {
Object objeto = parser.parse(errorJSON);
JSONObject objetoJSON = (JSONObject) objeto;
String error = (String) objetoJSON.get(ERROR);
resultado.a... |
ef211326-4656-4d3c-b118-01cf9ad26d49 | 7 | public static String addBinary(String a, String b) {
int len = Math.max(a.length(), b.length());
a = padding(a, len);
b = padding(b, len);
String res = "";
char flag = '0';
for(int i = len -1; i >= 0; i--){
char c = a.charAt(i);
if(flag == '0') {
if(c == '0'){
... |
d87d728e-2c04-4143-bbca-4ee87d579831 | 1 | public int copyin(int [] a){
if (a.length == st.length)
st = (int[])a.clone();
else return -1;
return 0;
} |
14055ac3-86bd-414a-a12f-5837a2dc5604 | 7 | @Override
public boolean mutate(DeterministicFiniteAutomaton dfa) {
Random rnd = new Random();
Set<State> states = dfa.getStates();
State[] stateArr = states.toArray(new State[0]);
if(states.size() <= 2){
return false;
}else{
//index of the state to be removed
int i;
State oldState = null;
... |
e06ed17b-0c3e-4c2b-989f-0ec231320761 | 0 | @Override
public void removeServerEventListener(IServerEventListener listener) {
serverEventListenerList.remove(IServerEventListener.class, listener);
} |
7de816df-e919-4381-9f75-bb209d1d4438 | 1 | public final String getTitle() {
Object value = getValue(NAME);
return value != null ? value.toString() : null;
} |
7923021e-189e-4427-8667-14fc880c60b4 | 1 | public People updatePeople(String peopleID, String personName, String projectID, String role) {
People people = manager.find(People.class, peopleID);
if (people != null) {
people.setProjectID(projectID);
people.setPersonID(peopleID);
people.setRole(role);
people.setName(... |
5e81e6f3-315e-4176-a3cb-0134e705b74d | 9 | @Override
public long doRead(Master master, ReadRequest readRequest) {
incrementAccessAndMaybeRecalibrate(master);
long fileId = readRequest.getFileId();
Location accessLoc = readRequest.getLocation();
MasterMeta fm = master.map.get(fileId);
if (fm == null || fm.instances.size() == 0) {
retu... |
7422fca2-89e1-4fb1-84e2-40340e181c6e | 1 | public Normal(double mu, double sigmaSquared) throws ParameterException {
if (sigmaSquared <= 0) {
throw new ParameterException("Normal parameters mu real, sigmaSquared > 0.");
}
rand = new Random();
this.mu = mu;
this.sigmaSquared = sigmaSquared;
sigma = Math.sqrt(sigmaSquared);
} |
68fb3e26-0869-4964-8a3a-8d912e416623 | 7 | private void getColor() {
color = new int[] { 0xFF111111, 0xFF000000, 0xFFC2FEFF };
switch (random.nextInt(8)) {
case 0: {
// red color
color[1] = 0xFFFF0000;
break;
}
case 1: {
// gold color
color[1] = 0xFFCFB53B;
break;
}
case 2: {
// blue color
color[1] = 0xFF005AFF;
break;
... |
21a85903-7d74-43fa-8713-dc1fdf530396 | 7 | void checkWorld(){
PVector toBest = new PVector(); //create a temp vector to keep track of the direction of the best condition
float maxV = 0;
//loop through pixels
for (int i = -p5.searchRad; i <= p5.searchRad; i++){
for (int j = -p5.searchRad; j <= p5.searchRad; j++){
if(!(i == 0 && j == 0)){
//c... |
a4fa9746-068c-4e5a-abb9-b67c3c9f5115 | 5 | @Override
public void execute(CommandSender sender, String worldName, List<String> args) {
this.sender = sender;
if (worldName == null) {
error("No world given.");
reply("Usage: /gworld setannouncedeath <worldname> <true|false>");
} else if (!hasWorld(worldName)) {
reply("World not found: " + worldNa... |
79a977a8-ad55-4fe9-bda7-40cc7bca052f | 8 | public void actionPerformed(ActionEvent e)
{
for(int i = 0; i < Main.list.size(); i++)
{
if(Main.list.get(i).getStatic() == false)
{
if(Main.list.get(i).getX() < 47 || Main.list.get(i).getX() > 1198)
{
Utility.tableCollision(Main.list.get(i), true);
}
if(Main.list.get(i).getY() < 47 || ... |
586edcf0-179a-4b5a-9a93-5ccc9c288e5a | 3 | private List<Block> getGolemBlocks(EntityType type, Block base) {
ArrayList<Block> blocks = new ArrayList<Block>();
blocks.add(base);
base = base.getRelative(BlockFace.UP);
blocks.add(base);
if (type == EntityType.IRON_GOLEM) {
for (BlockFace face : new BlockFace[]{ B... |
21283769-a645-453e-a9c8-09f73599efca | 0 | public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable
{
method.invoke(obj, args); //利用反射调用需要调用的方法
return null;
} |
76e6f8bb-a9a6-4783-84f3-09ac12e24c86 | 0 | public ConfigurationLoader getConfiguration() {
return this.cloader;
} |
8d1a4421-0a46-4dc6-baaa-d80592316943 | 2 | public void updateDatabase(){
//Temos alguma valor para inserir?
if(toInsert != null){
//Verificando a posição que ele vai entrar:
int temp = checkIfMadeIt(toInsert.getM_maxCoins());
if(temp >= 0){
m_scoreBoard.add(temp, new HighScoreEntry... |
1eebf0c5-a03d-49d5-8160-46f42937b754 | 2 | @Override
public ArrayList<Delta> apply(Color c, int x, int y, Color[][] colorArr) {
if (start == null) {
start = new Point(x, y);
return new ArrayList<>();
} else {
Point p1 = start;
Point p2 = new Point(x,y);
ArrayList<Point> ch = bresenh... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.