method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
b246a186-dbbd-427d-9dcf-11ed991d58af | 3 | @Override
public void remove() {
for (ForceFieldConnection forceFieldConnection : forceFieldConnections) {
for (ForceField forcefield : forceFieldConnection.getForceFieldsInConnection())
getGrid().removeElement(forcefield);
for (ForceFieldGenerator forceFieldGenerator : forceFieldConnection.getForceFie... |
5102c143-7995-42b1-85c4-07d84e79ef78 | 5 | public void handle(final Callback[] callbacks) throws UnsupportedCallbackException {
if (callbacks == null || callbacks.length == 0) {
return;
}
for (Callback cb : callbacks) {
if (cb instanceof NameCallback) {
NameCallback ncb = ... |
a5462ad6-3e57-4113-8eac-ed65d3bc0f27 | 0 | @Override
public void endElement(String namespaceURI, String localName, String qName) {
super.endElement(namespaceURI, localName, qName);
} |
0244939d-80b8-4f8e-b0ae-6c7ad2f83c74 | 3 | public static int getTreePointsSpent(String prestige){
for(ClassTree ct : takenPrestigeTrees){
if(ct.getPrestige().equalsIgnoreCase(prestige))
return ct.spentAp();
}
if(prestige.equalsIgnoreCase(characterRace))
return racialTree.spentAp();
return 0;//default
} |
78a3653b-3b10-4d85-a6ea-8ffa1395a04d | 3 | private void loadAvaliblePlattformar() {
DefaultComboBoxModel<Plattform> dcbm = (DefaultComboBoxModel<Plattform>) cbAvaliblePlattformar.getModel();
ArrayList<String> tempal = new ArrayList<>();
ArrayList<Plattform> al = new ArrayList<>();
try {
String query = "select pid fr... |
cb1739a3-ee42-4fa6-8f5e-cedb615f1431 | 0 | public ArrayList<Integer> getLocalFolders()
{
_read.lock();
try
{
return _localFolders;
}
finally
{
_read.unlock();
}
} |
666e977e-d9f6-4e2e-a1a5-1bf3a851b4d2 | 2 | public long getUserCommentsCount(String userId) {
long result = 0L;
DBCursor cursor = database.getCollection(ACTIVITY_COLLECTION).find(new BasicDBObject("_id", Pattern.compile("^" + userId)), new BasicDBObject("comment", 1));
try {
while (cursor.hasNext()) {
DBObject ... |
b890b8e7-ef51-4a68-babc-078faef5a8ce | 6 | private void retrievePublicKeys(List<String> list) {
String line;
boolean bNewKey = false;
String keyID = null;
for (String list1 : list) {
line = list1;
if (line.startsWith("pub")) {
Pattern p = Pattern.compile("^.*/([^\\s]+).*");
... |
f161af67-7342-4e1e-a949-322d5877efa3 | 0 | public static void println(Object s) {
System.out.println(s);
} |
eafaf7e6-b878-4de8-b574-12aa246ef0af | 1 | public PosFuncEstado getPosFuncEstado(int idPos, long cedula){
Object o[] = {idPos, cedula};
List<PosFuncEstado> list = getHibernateTemplate().find(
"from PosFuncEstado where fesIdPos = ? and fesCedula = ?",
o
);
if (list.size()>0){
return list... |
a8d8152b-46c9-4013-b110-8a110d2dce85 | 0 | private AnimFrame getFrame(int i) {
return (AnimFrame)frames.get(i);
} |
23fa9efa-ce47-45cd-9a90-da49952dc384 | 1 | @Override
public void setEnabled( boolean enabled ) {
if( !enabled ){
closeMenu();
}
} |
ff249711-cf78-4826-b6d1-4630eebb76ee | 1 | public void submit() {
// Get RMI data
RmiData socketData = new RmiData();
// Get list of problems
ArrayList<Problem> problems = socketData.getProblems();
ArrayList<Language> languages = socketData.getLanguages();
// Get selected problem and language
Problem problem = problems.get(problemComboBox.getSel... |
f4722520-3887-4fc0-be1a-81a32ed31fab | 3 | @Override
public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
if (!(sender instanceof Player)) {
Main.courier.send(sender, "messages.requiresPlayer", label);
return false;
}
final Player player = (Pla... |
bf92f7e1-bc12-4b99-81ba-6e17c2108c75 | 0 | public void setDestinationStop(int value) {
this._destinationStop = value;
} |
d85a4ad3-2eeb-4711-8856-41b6733ed04f | 3 | @Override
public void deserialize(Buffer buf) {
dungeonId = buf.readShort();
if (dungeonId < 0)
throw new RuntimeException("Forbidden value on dungeonId = " + dungeonId + ", it doesn't respect the following condition : dungeonId < 0");
int limit = buf.readUShort();
addedP... |
4b4f6f1a-6d09-4e5b-86ba-604b40f45bb4 | 4 | @Override
protected byte[] load_from_current_position(String frameId, int dataLen,
RandomAccessFile openFile) throws IOException {
byte[] frameData=new byte[dataLen];
MediaFileUtil.read_sure(openFile,frameData);
int offs=0;
int pictureTypeId = (int)MediaFileUtil.convert32bitsToUnsignedInt(frameData);
o... |
2b4f97a6-b471-4360-b71e-c8e14d0c771a | 8 | @Override
public Value applyOperator(FunctionOperator op, List<Value> otherValues)
{
Value first = otherValues.get(0);
switch (op.toString()) // the two current operators aren't actually supported/ever used
{
case ".[]":
if (first instanceof IntValue)
{
int index = (int) ((IntValue) first).getVa... |
6b7d7d22-29c6-4163-bd7c-2cdabf744569 | 0 | @Override
public PrintWriter getLogWriter() throws SQLException {
return null;
} |
3de8e3ae-9032-4006-8a5b-54632cbce9e9 | 4 | public ArrayList<Move> getRegularMoves(Board currentBoard, boolean onlyChainable, Checker checker) {
//List of possible moves.
ArrayList<Move> moves = new ArrayList<Move>();
//Add all regular moves to the list.
moves.add(new ForwardLeft(currentBoard, checker));
moves.add(new ForwardRight(currentBoard, chec... |
13d878a8-dbc9-4e57-91d4-094b18815cc7 | 7 | public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// 输入n
int n = Integer.parseInt(sc.nextLine());
// 创建ArrayList用于存放每一个十六进制字符串。将其容量设置为n,避免空间增长的时间消耗
ArrayList<char[]> list = new ArrayList<>(n);
// 将每个字符串的字母转换为大写后,将字符串转换成char数组并添加到ArrayList中
for (int i = 0; i < n; i++) {
Strin... |
931659bc-5614-4786-b6b3-51970417a50b | 5 | @SuppressWarnings("unchecked")
public static ViewMapper getView() {
// 根据请求地址映射到具体的视图控制器
HttpServletRequest req = WebContext.getRequest();
String uri = req.getServletPath().split("\\.")[0];
ViewMapper viewMapper = ContextConfig.getMapperCtrl().get(uri);
List<Object> params = new ArrayList<Object>();
// 如果视... |
f4e51740-056c-4a5a-b850-87cf9d54323c | 7 | private E getResult(boolean findMax) {
int index = 0;
Entry<Integer, Double> result = null;
if (findMax == true) {
Iterator<Entry<Integer, Double>> s = fitScores.entrySet().iterator();
for (; s.hasNext(); )
{
Entry<Int... |
1b023058-0849-4ec1-affa-c92abb24a1d4 | 6 | public Pair<Integer, TilesetRef> mapGidToFirstGidTilesetPair(int gid) {
if (gid == 0) {
return new Pair<Integer, TilesetRef>(0, null);
} else if (tilesets.containsKey(gid)) {
return new Pair<Integer, TilesetRef>(gid, tilesets.get(gid));
} else {
int last_key_gid = 0;
for(int current_key_gid : tilesets... |
11954067-2915-4f27-900c-83ed5827b162 | 6 | public boolean isOn() {
boolean hasStock = false;
outer:for (int i = 0; i < this.dispensers.size(); i++) {
if (!this.dispensers.get(i).getDispenserContents().isEmpty()) {
hasStock = true;
break outer;
}
}
if (!hasStock || !this.on) {
on = false;
return false;
}
Date temp = new Date();
... |
8762b7cd-9e05-4c20-b889-df5376c1c3e8 | 2 | @Override
public Course unassignRoleSchoolFromCourse(long roleId, long courseId) {
// for(Person person : persons){
// List<RoleSchool> roles = (ArrayList<RoleSchool>)person.getRoles();
// for(RoleSchool role : roles){
// if(role.getId() == roleId){
// ... |
cbc07e57-5eb2-4f3f-ad8f-297ac281af22 | 5 | public final void method44(int i, AbstractToolkit var_ha) {
anInt9986++;
Object object = null;
r var_r;
if (aR9976 != null || !aBoolean9988) {
var_r = aR9976;
aR9976 = null;
} else {
Class2 class2 = method2401(var_ha, 262144, true, 22);
var_r = class2 == null ? null : ((Class2) class2).aR118;
... |
359fde4d-dde0-4c0f-88d1-a6d2cf429e89 | 4 | private void parse(String query) {
try {
// StringTokenizer is faster than split. http://www.javamex.com/tutorials/regular_expressions/splitting_tokenisation_performance.shtml
StringTokenizer st = new StringTokenizer(query, "&");
while (st.hasMoreTokens()) {
S... |
22ac5ee2-3813-486a-af92-46eb3fa8ca0f | 1 | public void uimsg(int id, String msg, Object... args) {
Widget w = widgets.get(id);
synchronized(robots) {
for(Robot r : robots)
r.uimsg(id, w, msg, args);
}
super.uimsg(id, msg, args);
} |
aa724c13-0396-4256-a445-1e1bc3bc6591 | 6 | public static void vendingMachine(char a, int n){
int price = 0;
if(a == 'w' || a == 'W') {
price = 10;
checkPayment(price, n, a);
} else if (a == 'j' || a == 'J') {
price = 15;
checkPayment(price, n, a);
} else if ( a == 'c' || a == 'C') {
price = 12;
checkPayment(price, n, a);
... |
7b7ddc1f-f930-4dcf-918f-ec194486f3f6 | 2 | @Override
public void addTextBack() {
Element textBack = text.getOwnerDocument().createElement("path");
String d = "M";
for (Coordinate c : geometry.getCoordinates()) {
if(d.length()>1){
d=d+" L";
}
d = d + " " + c.x + "," + c.y;
}
textBack.setAttribute("d", d);
textBack.setAttribute("style", ... |
819daba0-1fc9-4d51-8e89-069e7ad41925 | 4 | public void mousePressed(MouseEvent e) {
if (!b.isEnabled()) return;
if (b instanceof javax.swing.JToggleButton) {
b.setBorder((b.isSelected() ? inactive : lowered));
b.setBorderPainted((b.isSelected() ? false : true));
} else {
b.setBorder(lowered);
b.setBorderPainted(... |
d0d45915-6adf-4afa-bbfb-25874898abe8 | 7 | protected boolean controlThicknessInput(JTextField textfield, int maxLength, boolean negativeAllowed) {
boolean ret = true;
String tmp = textfield.getText();
if (negativeAllowed && tmp.matches("-")) {
ret = false;
} else if ((!negativeAllowed && !tmp.matches("[0-9]++")) || ... |
8f3f5d33-5aa5-441f-a5da-4cb4766f6431 | 4 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ArrayID other = (ArrayID) obj;
if (arrayId != other.arrayId)
return false;
return true;
} |
11bb1c47-b97c-4f91-adca-b0b627cf761c | 3 | public void login()
{
if (!ValidationHelper.isNullOrEmpty(getLogin(),getPassword()))
{
setPassword(DigestUtils.md5Hex(getPassword()));
setUser(IndexedEntityService.em
.createNamedQuery("User.findByLogin", User.class)
.setParameter("logi... |
3404b526-02fb-42c5-a84b-23cec95a641a | 3 | private boolean runSingleCycleAndContinue() {
if (checkReturnCode("Do you want to create a new Cell(Y/N)?"))
addLivingCellAndPrint();
if (checkReturnCode("Do you want to apply a tick (Y/N)?"))
applyTickAndPrint();
if (checkReturnCode("Do you want to quit (Y/N)?"))
... |
0321e41a-dc21-4d51-a6fc-0724227ed6e3 | 8 | final void method3049(ByteBuffer class348_sub49, int i, int i_0_) {
if (i_0_ != 31015)
method3049(null, 44, 80);
int i_1_ = i;
while_200_:
do {
while_199_:
do {
do {
if ((i_1_ ^ 0xffffffff) != -1) {
if (i_1_ != 1) {
if (i_1_ != 2) {
if ((i_1_ ^ 0xffffffff) != -4)
break wh... |
6fb0597d-b9ac-4410-89d9-9d2c1a907dbe | 7 | public void paint(Graphics g_) {
super.paint(g_);
Graphics2D g = (Graphics2D) g_;
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g.setColor(Color.LIGHT_GRAY);
g.fillRect(0, 0, getWidth(), getHeight());
if (socket.getGate() == null... |
b622cf34-0e31-4f8b-8aa9-c458d452095e | 3 | public MySQLDataStorageImplementation(Decapitation decapitation, String url, String username, String password) throws SQLException {
plugin = decapitation;
connection = DriverManager.getConnection(url, username, password);
final ResultSet bansExists = connection.getMetaData().getTables(null, nu... |
27c768ac-8524-409e-9976-d75b13d60a9d | 3 | public static List<String> getResult() {
for (Thread t : threads) {
try {
if (!t.isInterrupted()) {
t.join();
}
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return result;
} |
d2886132-da4a-4918-8c42-1ae1012c3998 | 4 | public void stop() {
if(player != null) {
if(fadeTime == 0.0f || this != gamePlayList.getCurrentSong() || gamePlayList.getStopping()) {
stopFadeIn();
stopFadeOut();
// setVolume(getMinGain());
// if(playerThread != null) {
// ... |
70a09e47-0057-47fa-b8bc-40fed8dd236b | 1 | public boolean hasPartName(String xpathExpression){
if (xpathExpression.contains("/")){
String varPart = xpathExpression.substring(0, xpathExpression.indexOf("/"));
return varPart.contains(".");
}else{
return xpathExpression.contains(".");
}
} |
730b2d00-b5e5-43e6-acd2-10e9c441beff | 6 | private void handleDevices(AjaxRequest vars, HttpServletRequest request, HttpServletResponse response) {
EntityManager em = getEntityManager();
CommunicationDeviceDao dbDevice = new CommunicationDeviceDao(em);
CommunicationDeviceTypeDao dbType = new CommunicationDeviceTypeDao(em);
if (... |
bf47af42-9dc2-49aa-929c-07e544c8a881 | 6 | public Block getBlock(int x, int y, int z) {
if(x < 0 || x >= w_width || y < 0 || y >= w_height || z < 0 || z >= w_depth) return Block.air;
return Block.blocks[blocks[x][y][z]];
} |
ef104be6-5608-44d8-8024-e892edb4a0df | 4 | public CuttingResult getReward(Tilia x){
ArrayList<Integer> pieces = new ArrayList<Integer>();
pieces.add(x.getSide());
// First two variables in CuttingResult are not used
CuttingResult best = new CuttingResult(0, 0, x.getReward(), pieces);
// Try possible cuts
for (int i =1 ; i ... |
d9ace60c-a14d-4ae0-8a4e-22332b947a27 | 1 | public void exception(){
long result = a.getTimeLeftInMillis();
if(result <= 0){
System.out.println("The bid for " + a.getName() + " has expired.");
}
} |
f4cdcd41-2161-47b2-8983-a5c530b6fb68 | 3 | public static void addAllCombos(String previous, int len) {
if (len == 0) {
if (checkHash(previous)) Solutions.add(previous);
// System.out.println(previous);
}else {
for (int i = 0; i < CHARS.length; i++) {
String next = previous + CHARS[i];
addAllCombos(next, len - 1);
}
}
} |
589867bc-2947-4699-8f02-b6e2ef2a2229 | 9 | public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2=(Graphics2D)g;
if (cb_antialias.isSelected()) {
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_... |
657361dd-4246-407c-8a75-8da786a5b8b8 | 7 | private void solve (int col, int row) throws Exception {
runCount++;
if (runCount>40000) {
System.out.println("Solution not found");
throw fail;
}
if (row>8) {
System.out.println("Solved");
throw new Exception("Solution succesful");
}
if (solutionArray[col][row] != 0) {
next(col,row);
} els... |
8451ce19-872f-4481-8db8-5b8c1397ef34 | 3 | private void update() {
long now = System.currentTimeMillis();
if (now - lastLine > lineDelay) {
if (!view.getGrid().newLine()) {
timer.cancel();
if (view.newGame()) {
init();
return;
} else {
... |
d9932b86-eb6e-4308-a378-abd1312586bb | 3 | public static void main(String[] args) {
// TODO code application logic here
int i = 1;
int count = 0;
boolean s = true;
while (s) {
i++;
if (Prime(i)) {
count++;
}
if (count == 10001) {
s = false;
... |
f425d7ac-05b3-4d53-961b-1b90ea63c4a6 | 8 | @Override
public void run() {
while (true) {
try {
// Wait for an event one of the registered channels
this.selector.select();
// Iterate over the set of keys for which events are available
Iterator<?> selectedKeys = this.selector.... |
0e3618bd-6898-496b-964f-1662f7728c2c | 0 | @Override
public String toString() {
return "CallType is " + remoteCallObjectType + "\n" +
"Command is " + execCommand;
} |
3ab84aff-a721-4dfc-bc89-9224e0e7857d | 6 | private String getFieldName(ExtendedField field) {
try {
if (field.hasDBMapping()) {
return field.getDBColumnNameWithoutEscape();
}
if (field.hasEntityMapping()
&& MappingType.MANY_TO_ONE.equals(field.getEntityMapping())) {
return field.getTableName() + "_UUID";
}
if (field.hasEntityMappi... |
026174bf-271e-4e78-b844-8f02d77b6310 | 2 | public String getShortDateUS(){
this.shortDateUS = (new Integer(this.getMonthAsInteger())).toString();
if(this.shortDateUS.length()<2)this.shortDateUS = "0" + this.shortDateUS;
int dayI = this.getDayOfTheMonth();
if(dayI<10){
this.shortDateUS += "/0" + dayI;
}
... |
25236d08-18e6-4e89-a5c0-a586e58a7a26 | 7 | private void handleMousePressed(int x, int y) {
x -= 50;
y -= 50;
x /= 16;
y /= 16;
if ((x < 0) || (y < 0) || (x >= map.getWidthInTiles()) || (y >= map.getHeightInTiles())) {
return;
}
if (map.getUnit(x, y) != 0) {
selectedx = x;
selectedy = y;
lastFindX = -1;
} else {
if (selectedx != ... |
52156636-e08a-4e85-8912-88fe9908ca8b | 8 | public int flags(int x, int y) // get the number of surrounding flags
{
int surFlags = 0;
for (int q = x - 1; q <= x + 1; q++) {
for (int w = y - 1; w <= y + 1; w++) {
while (true) {
if (q < 0 || w < 0 || q >= row || w >= col) // makes sure
// that it wont
// have an err... |
9a353550-956f-4e3e-8fae-af6e6b08b314 | 4 | @Override
protected void generateLevel()
{
// Grass = 0xFF00;
// Flower = 0xFFFF00;
// Rock = 0x7F7F00;
for (int i = 0; i < levelpixels.length; i++) {
if (levelpixels[i] == 0xff00) {
tiles[i] = Tile.grass;
}
if (levelpixels[i] == 0xffff00) {
tiles[i] = Tile.flower1;
}
if (levelpixels[i... |
c11e8cfd-3045-4d5c-b083-a39bab5b5057 | 8 | @Override
public void quickPlay( boolean priority, boolean toStream, boolean toLoop,
String sourcename, FilenameURL filenameURL, float x,
float y, float z, int attModel, float distOrRoll,
boolean temporary )
{
IntBuffer myB... |
eab737f9-b64b-4b2e-815a-9af5870fc705 | 6 | private void dealDamage(GridSpace target, Weapon weapon, Point targetLocation) {
ArrayList<LivingThing> livingThings = target.returnLivingThings();
Character c = (grid.get(getCharacterLocation())).returnCharacter();
if (livingThings == null || livingThings.size() == 0) {
return;
} else {
for (LivingThing ... |
fbf12a8c-836c-476d-8b14-9b5557efa6bc | 0 | public void chercher() {
String nom = (String) this.vue.getjComboBoxSearch().getSelectedItem();
String[] libelle = nom.split(" ", 0);
System.out.println(libelle[0] + " " + libelle[1]);
Praticien unPraticien = DaoPraticienJPA.selectOneByNomPrenom(em, libelle[0], libelle[1]);
affic... |
c2796e24-912b-4d45-b395-7230e688698f | 4 | public static void quickSort(int[] array, int lowIndex, int highIndex) {
// this.printArray();
// System.out.println("low:high="+lowIndex+":"+highIndex);
if (lowIndex >= highIndex)
return;
count2 += (highIndex - lowIndex);
int i = lowIndex + 1;
int pivot = choosePivot(array, lowIndex, highIndex);
in... |
4bacf179-7a79-4032-b3fc-bb4983ac4b35 | 4 | private static final List<Integer[]> drawCircle(Graphics graphics,
int xc, int yc, int radius) {
/*
* Declare and initialise local variables.
* The origin is base on positive y-axis at (0,r)
*
* int x and y - Circle coordinates use
* to d... |
9b2d40e1-5876-44c7-84ee-304e76271fbb | 5 | @Override
public boolean retiro(int codigo, double m) {
try{
boolean seRetiro = false;
double saldo = 0;
if( buscarCuenta(codigo) ){
TipoCuenta tc = TipoCuenta.valueOf(rCuentas.readUTF());
rCuentas.readUTF();
sa... |
5c338a9f-d6f1-4dd4-abef-177efed12d71 | 9 | Point3f getFaceCenter(byte face) {
if (faceCenter == null)
faceCenter = new Point3f();
switch (face) {
case TOP:
switch (axis) {
case 'x':
faceCenter.set(center.x + 0.5f * height, center.y, center.z);
break;
case 'y':
faceCenter.set(center.x, center.y + 0.5f * height, center.z);
break;... |
387af50e-6623-4640-9af9-af37b1c23f30 | 9 | private void setStatus(int status)
{
if ((status & 128) == 128)
FIN = true;
if ((status & 64) == 64)
RSV1 = true;
if ((status & 32) == 32)
RSV2 = true;
if ((status & 16) == 16)
RSV3 = true;
// if the opcode is 8, then w... |
8c73d7e3-6eb5-4866-834b-82d4abe52dc8 | 3 | public int execute() {
// The LOGLEVEL command is described as follows:
// LOGLEVEL [<level>]
if( this.getParamCount() == 0 ) {
// this.getFactory().getServer().performLogLevel( null );
this.getFactory().getServer().getLogger().log( Level.INFO,
"Current log level is: " + this.getFactory().ge... |
152d9823-6546-48b2-885e-e10dead65642 | 9 | public static int howManySundays0(){
int sundays = 0;
//first pass
int day = 1;
int year = 1900;
for(; year < 1901; year++)
for(int month = 1; month <= 12; month++)
for(int date = 1; date <= daysInMonth(month, year); date++, day++){
if(day % 7 == 0)day = 0;
}
for(; year <= 2000; year++){
... |
a2b60e17-7cb2-43df-a7d7-771540b2965e | 5 | public static ArrayList<Entity> getEntitiesWithinRange(Point location, double maxRange, Team entityTeam) {
ArrayList<Entity> entitiesWithinRange = new ArrayList<Entity>();
if (entityTeam == Team.EVIL) {
for (Enemy enemy : enemies) {
if (enemy.isLocationWithinDistance(location, maxRange)) {
entitiesWithi... |
0d032467-26ff-4fdd-ab49-5203d2ef80b4 | 7 | public SecureChannel (byte[] secret, String algs)
throws NoSuchAlgorithmException
{
// reset counters
countIn = countOut = 0;
String digAlg = null;
String encAlg = null;
pending = null;
// parse definition string
int pos = algs.indexOf ('/');
if (pos < 0) {
// we have only one algorithm: fin... |
636cff2e-497b-4032-a8fb-58f4e98c3298 | 6 | public static String convertId(Object value){
if(value != null && String.class.isAssignableFrom(value.getClass())){
return value.toString();
}
else if (value != null && Double.class.isAssignableFrom(value.getClass())) {
StringBuilder sb = new StringBuilder();
... |
7f34aad4-69f5-4a78-83fe-533f1e3856bb | 9 | public List<Action> selectActions(boolean units, boolean buildings, boolean research, boolean upgrades) {
List<Action> actions = new ArrayList<Action>();
for(Action action : this.actions){
if (action.type == Type.Building && buildings)
actions.add(action);
if (action.type == Type.Unit && units)
actions.add... |
7a58e417-5a28-46f4-9d5b-7d693b28750f | 8 | public TypeBinding postConversionType(Scope scope) {
TypeBinding convertedType = this.resolvedType;
// if (this.genericCast != null)
// convertedType = this.genericCast;
int runtimeType = (this.implicitConversion & IMPLICIT_CONVERSION_MASK) >> 4;
switch (runtimeType) {
case T_boolean :
convertedType = T... |
1f9a7de5-bd45-45ba-ba42-db8e2f1b1ddd | 0 | @Override
public double getArea() {
return _width * _height;
} |
9d7fa60d-5de2-48f2-9737-dcb62244f85f | 5 | public void run() {
try {
boolean work = true;
while (work) {
String str = in.readLine().replace(";;", "\n");
GUI.memo.append( "Server recived message:" );
GUI.println( str );
if (str == "END") {
socket.close();
UserList.user_list.remove(port);
work = false;
break;
} else... |
d14038d2-9d56-4b70-bc22-9de4223435b3 | 0 | public String toCSV() {
return super.toCSV();
} |
be0bb0b4-d47f-4c05-a993-a79768837f77 | 3 | public void act() {
move();
Vector players = find("players");
if (players.size() > 0) {
for (int p = 0; p < players.size(); p++) {
Agent other = (Agent) players.elementAt(p);
//The agents only play when *both* have moved.
if (other.hasM... |
d9b53acc-f681-447d-983b-5b8ab26ca1f0 | 6 | @Override
public void run() {
if (Updater.this.url != null) {
// Obtain the results of the project's file feed
if (Updater.this.read()) {
if (Updater.this.versionCheck(Updater.this.versionName)) {
if ((Updater.this.versionLi... |
44b5a7a1-e0c6-44a5-ac8b-5b97fb652eee | 1 | static CursorContext getNepticalContext(NepticalContext nepticalContext) {
if (nepticalContext.getContextKey() == null) {
ContextKey contextKey = CONTEXT_KEY_FACTORY.createContextPartitionKey("UNSAFE".hashCode(),
nepticalContext.getIdentity().toString(), Location.class);
nepticalContext.setContextKey(conte... |
9591c47c-365f-4e29-b9e3-9039ac8905b1 | 4 | public static void main(String[] args) throws IOException,
ParserConfigurationException, SAXException {
String path = "BIGxml.xml";
boolean error = false;
try {
if (args.length > 0) {
if (isValidXML(args[0])) {
path = args[0];
}
else {
System.out
.println("Invalid file path. P... |
1574ab23-b2ef-42d6-9292-f662091c09e4 | 2 | public void updateCustomer(boolean equal) {
Database db = dbconnect();
try {
StringBuilder query = new StringBuilder ();
query.append("UPDATE customer SET firstname = ?, "
+ "lastname = ?, username = ?");
... |
b39c98df-b57c-4752-af1d-0fd3440444be | 4 | public static void giveFlag(Cuboid c, String player, Flag flag) {
if (c == null || player == null || flag == null) return;
if (c.getFlags().get(flag).contains(player)) return;
c.getFlags().get(flag).add(player);
} |
891cff73-5916-4e98-a843-30630d4093f0 | 5 | public static List<Trends> constructTrendsList(Response res)
throws WeiboException {
JSONObject json = res.asJSONObject();
List<Trends> trends;
try {
Date asOf = parseDate(json.getString("as_of"));
JSONObject trendsJson = json.getJSONObject("trends");
trends = new ArrayList<Trends>(trendsJson.length()... |
376d4943-3fc7-41d4-a326-849379de4062 | 4 | private static void findAllMaps(List<String> allMaps) {
try {
File[] folderFiles = MAP_FOLDER.listFiles();
assert folderFiles != null;
for (File fileEntry : folderFiles) {
if (fileEntry.isDirectory()) {
findAllMaps(allMaps);
} else {
String name = fileEntry.getName();
if (nam... |
640497d1-1584-4cb0-af05-231713afb7d0 | 1 | @Override
public void update() {
Background background = null;
for (int i = 0; i < backgrounds.size(); i++) {
background = backgrounds.get(i);
background.update();
}
super.update();
} |
994bb16a-90f0-4152-bb6c-ec7f66026fe9 | 7 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!(affected instanceof MOB))
return true;
final MOB mob=(MOB)affected;
// when this spell is on a MOBs Affected list,
// it should consistantly prevent the mob
// from trying to do ANYTHING except sleep
if(msg.amISour... |
48220b70-c7c5-4f08-9cec-81b07b8fab8b | 2 | public void InsertarVideo(ArrayList datos)
{
// Cambiamos todos los datos, que se puedan cambiar, a minúsculas
for(int i = 0 ; i < datos.size() ; i++)
{
try{datos.set(i, datos.get(i).toString().toLowerCase());}
catch(Exception e){}
}
biblioteca.inserta... |
21c6435f-b2df-49d8-8892-d6caa0349e64 | 6 | static public void adjustBeginLineColumn(int newLine, int newCol)
{
int start = tokenBegin;
int len;
if (bufpos >= tokenBegin)
{
len = bufpos - tokenBegin + inBuf + 1;
}
else
{
len = bufsize - tokenBegin + bufpos + 1 + inBuf;
}
int i = 0, j = 0, k = 0;
int nextCol... |
3abdfac4-bda3-4963-a52b-4bcf260baffc | 2 | public int getCoverage() {
int coverage = 0;
if (evalFalse > 0)
coverage += 50;
if (evalTrue > 0)
coverage += 50;
return coverage;
} |
0b0da476-9cf2-49be-80b8-23deb5bef881 | 6 | public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
// g.drawImage(skybg, 0, 0);
g.setBackground(new Color(61, 52, 73, 1));
level.map.render(0,0);
if(player.alive)
g.drawAnimation(player.animation , player.x, player.y);
g.drawImage(levelText[0], 370, 10);
g.draw... |
e19d69e0-0881-4419-bb14-1b72eb6ccad9 | 8 | @Override
public Vector2f getHitSideVector(Entity entity) {
Shape[] skeleton = getSkeleton();
Vector2f vector = new Vector2f();
float ex = entity.getBBCentre().getX();
float ey = entity.getBBCentre().getY();
float cx = getBBCentre().getX();
float cy = getBBCentre().ge... |
40264c3c-03d4-4c32-93e4-989a9a0ba717 | 2 | private MapPortal getMapPortal(Point location){
for (MapPortal portal : getPortals()){
if (portal.getLocation().equals(location)){
return portal;
}
}
return null;
} |
482c9bc1-4cc3-4b98-9fa9-255e59a0fd50 | 6 | @Override
public Stream resolveStreamUrl(final String url, boolean skipLogging) throws IOException {
HttpResponse resp = head(Request.to(url));
if (resp.getStatusLine().getStatusCode() == HttpStatus.SC_MOVED_TEMPORARILY) {
Header location = resp.getFirstHeader("Location");
if... |
a6eb0fd7-0e78-4a68-9f20-e5966521fbea | 4 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Room other = (Room) obj;
if (uid != other.uid)
return false;
return true;
} |
2d2bc271-0a2c-420f-8e71-11e099d693b9 | 9 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if((affected!=null)&&(affected instanceof MOB)&&(tickID==Tickable.TICKID_MOB))
{
final MOB mob=(MOB)affected;
if((buildingI==null)
||((fireRequired)&&(getRequiredFire(mob,0)==null))
||(theSpell==null))
{
aborted=true;
unInvoke();... |
8bd1563c-95e7-4bf0-b73b-3a954cf9f39c | 1 | public Graph createGraph(final String name) {
if (name == null) {
throw new IllegalArgumentException("Graph name cannot be null");
}
// Construct the graph object
final Graph graph = new Graph(name);
// Now we can add our graph
graphs.add(graph);
//... |
def7ddb2-696b-4fb7-9589-f96defa9f3be | 7 | public final String method1(int i, int j, int ai[], long l) {
if (j != -8945) {
method1(-60, -74, null, -72L);
}
if (i == 0) {
Class142_Sub27_Sub14 class142_sub27_sub14 = Animation.method962(ai[0], -2882);
return class142_sub27_sub14.method1887((int) l, (byte)... |
04cdce72-e276-415a-af82-b512f8ed0943 | 3 | private String getRightStringResult(String step, int pos, char value) {
String result = "";
pos++; // the initial position is already taken care of
int max = step.length();
for (; pos < max; pos++) {
if (step.charAt(pos) != '0' && step.charAt(pos) != '1') {
break;
}
result += value;
}
return re... |
6f0f028a-ebc7-4931-b7d7-47ad80060805 | 2 | public SQLite_helper() throws Throwable {
// load driver; connect to DB
Class.forName("org.sqlite.JDBC");
con = DriverManager.getConnection(urlToDb);
// test if Tables have already been set up; initialize if not
try {
pst = con.prepareStatement("SELECT * FROM users;");
rs = pst.executeQuery();
... |
ec2eaf45-9012-4a47-8d09-4343fed6cb99 | 3 | @Override
public boolean equals(Object obj)
{
if (this == obj)
{
return true;
}
if (obj instanceof ActorModel)
{
ActorModel currentActor = (ActorModel) obj;
if (currentActor.id == this.id)
{
return true;
}
}
return false;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.