method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
3e73724f-7460-404e-bbc0-e673bfafb091 | 9 | private ClassDef classdef() {
//ClassDef aClassDef = new ClassDef();
Object aux_local = symbolTable.getLocal();
this.symbolTable.cleanLocal();
ArrayList<Atom> atomList = new ArrayList<Atom>();
lexer.nextToken();
if (lexer.token != Symbol.ID) {
error.show("Nome... |
f22ce17d-20e5-47dc-aa00-8a8cb186c99d | 4 | public void playSpell(Card c) {
// System.out.println("Playing " + c.getCardName());
if (c.getType().equalsIgnoreCase("creature"))
p1.addCreature(c);
if (c.getKeywords().contains("damage"))
p1.damage(Character.getNumericValue(c.getKeywords().charAt(0)));
if (c.getKeywords().contains("draw")) {
try {
... |
92085573-e7a8-4546-b5d4-117d77be50f8 | 5 | public void startListeningClient() {
new Thread() {
@Override
public void run() {
String textoRecibido;
try {
do {
textoRecibido = inputStream.readUTF();
if (!"exit".equals(textoRecibido))... |
43d22e8b-55bd-4dc9-b7cc-0254a7884d11 | 0 | public String getName() {
// The screenName is the name of the screen's file.
return screenPath.substring(screenPath.lastIndexOf('/') + 1, screenPath.lastIndexOf('.'));
} |
f32d1eb8-9616-4d1f-a8d9-532ea265bd67 | 9 | private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
try {
if (validarDatos()){
//cargo Parametros del Reporte
Map parametros = new HashMap();
parametros.put("name_empresa", r_con.getRazon_soci... |
25116cd4-ed8d-4186-ab4c-8d87b0dfdb88 | 9 | public static boolean putUserInDatabase( String currentUser_id, String token, DMSUser user ){
String userRealName = user.getrName();
if (userRealName == null ) throw new DMSClientErrorException("Invalid person name.");
if (userRealName == "" ) throw new DMSClientErrorException("Invalid person name.");
userRealN... |
a54ef954-d0ff-4938-a695-1e28c53c0dba | 1 | public synchronized void adicionar()
{
try
{
new CursoView(this);
}
catch (Exception e)
{
}
} |
6f6121b3-85a4-4348-80d3-7faed59d3247 | 6 | private static final Object[] decodeInteger(byte[] bencoded_bytes, int offset) throws BencodingException
{
StringBuffer int_chars = new StringBuffer();
offset++;
for(; bencoded_bytes[offset] != (byte)'e' && bencoded_bytes.length > (offset); offset++)
{
if((bencoded_bytes[... |
368d41ee-f483-40c4-93cb-4afe1248a595 | 8 | public boolean updatePerf(String region, String agent, String plugin, String resource_id, String inode_id, Map<String,String> params)
{
boolean isUpdated = false;
String edge_id = null;
try
{
//make sure nodes exist
String resource_node_id = getResourceNodeId(... |
29c68b4c-b702-40f2-8ac8-48efc86f805e | 5 | @Test
public void testServerClientDisconnect() {
LOGGER.log(Level.INFO, "----- STARTING TEST testServerClientDisconnect -----");
String client_hash = "";
String server_hash = "";
try {
server1.startThread();
} catch (IOException | ServerSocketCloseException | Feat... |
6d31e0b5-0ff3-4767-901f-0f79934453fc | 9 | public List<Tuple<Integer,Integer>> aStar ( Tuple<Integer,Integer> start, Tuple<Integer,Integer> goal) {
log.debug("A* is looking for a path from " + start + " to " + goal);
// Set closedSet = empty set
HashSet<Tuple<Integer,Integer>> closedSet = new HashSet<Tuple<Integer,Integer>>();
// The set of tentative n... |
c16339cf-f99d-4385-9001-289978dd17e1 | 1 | public void attachClean(Member instance) {
log.debug("attaching clean Member instance");
try {
Session session = getSession();
Transaction tr = session.beginTransaction();
session.lock(instance, LockMode.NONE);
tr.commit();
session.flush();
session.close();
log.debug("attach successful");
}... |
6c2b85cf-3c8e-46b1-9fad-1c4219e27536 | 0 | public void setMainWindowModel(MainWindowModel mainWindowModel) {
this.mainWindowModel = mainWindowModel;
} |
190d4e9f-0008-408a-8eb0-a1a1104afc53 | 8 | public FlyAWayView(SingleFrameApplication app) {
super(app);
initComponents();
// status bar initialization - message timeout, idle icon and busy animation, etc
ResourceMap resourceMap = getResourceMap();
int messageTimeout = resourceMap.getInteger("StatusBar.messageTime... |
3c0186f4-880e-40a3-aaa1-76c621668b71 | 4 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final AbstractNode other = (AbstractNode) obj;
if (this.xPosition != other.xPosition) {
return fals... |
1cfdc8f8-dcdf-4a6b-8098-a4a02f339a17 | 3 | public void writeModelToFile(String fileName) throws IOException {
BufferedWriter out = new BufferedWriter(new FileWriter(new File(fileName)));
//write smoothingValue
out.write(">smoothingValue\n");
out.write(Double.toString(smoothingValue) + "\n");
//write featureValueRelativeRoleFrequency
out.write(">f... |
9ce63fd2-9ef0-4845-8bef-d31c27ecd09a | 1 | @Test
public void filtersByPublisherWorks2() {
citations.add(c1);
citations.add(c2);
citations.add(cnull);
filter.addFieldFilter("publisher", "Diktaattori");
List<Citation> filtered = filter.getFilteredList();
assertTrue(filtered.contains(c2) && filtered.size() == 1);... |
d395328b-27ba-4fd5-b2f6-ab81fe850ba8 | 1 | public void updateSubTypes() {
if (!isVoid())
subExpressions[0].setType(type);
} |
226f7606-3b4a-41e0-9011-6a1974813f57 | 3 | public static ArrayList<Borne> getAllBorne() {
Statement stat;
ArrayList<Borne> bornes = new ArrayList<>();
try {
stat = ConnexionDB.getConnection().createStatement();
stat.executeUpdate("use nemovelo");
ResultSet res = stat.executeQuery("select * from borne"... |
cd48776f-4fd5-493c-bcea-c93d66c87d52 | 8 | public boolean compare(Reader input, Reader correct) throws IOException
{
char i;
char c;
int x = 0;
int y = 0;
while(true)
{
while(x != -1 && Character.isWhitespace(x))
x = input.read();
while(y != -1 && Character.isWhitespace(y))
y = correct.read();
if(x != -1 || y != -1)
break;
i... |
92556b39-3acb-4eee-a43c-e84953f8f041 | 5 | @Override
public void mousePressed(MouseEvent e)
{
zoomGesture = hitZoomHandle(e.getX(), e.getY());
if (graphComponent != null && !e.isConsumed()
&& !e.isPopupTrigger()
&& (finderBounds.contains(e.getPoint()) || zoomGesture))
{
start = e.getPoint();
}
} |
94f0b1ef-4338-4985-afb7-534ff15bf6fc | 6 | * @return GeneralizedSymbol
*/
public static GeneralizedSymbol internStellaName(String name) {
{ Module module = ((Module)(Stella.$MODULE$.get()));
{ String barename = null;
String modulename = null;
Keyword kind = null;
{ Object [] caller_MV_returnarray = new Object[2];
... |
98e93b0e-8013-46cc-be03-5a31add33daa | 8 | @Override
public boolean equals(Object other) {
if (other instanceof Pair) {
Pair otherPair = (Pair) other;
return
(( this.first == otherPair.first ||
( this.first != null && otherPair.first != null &&
this.f... |
6b2ad116-0142-499a-bff7-131a162aa619 | 8 | public Set<Map.Entry<Byte,Byte>> entrySet() {
return new AbstractSet<Map.Entry<Byte,Byte>>() {
public int size() {
return _map.size();
}
public boolean isEmpty() {
return TByteByteMapDecorator.this.isEmpty();
}
public ... |
8bc42eea-6f3b-4922-8088-4ee828c4ead1 | 1 | public static void main(String args[])
{
Joculus app_instance = new Joculus();
String cp = System.getProperty("java.class.path");
System.out.println("Classpath: " + cp);
if (app_instance.init(args))
{
// app_instance.run();
}
} |
af69fe45-747b-489b-a376-efe25cccf7c9 | 1 | @Override
public final String getColumnName(final int columnIndex) {
if (columnIndex == 0) {
return "#";
} else {
return "Program";
}
} |
c1021928-3c2b-4886-814f-9874acb5f1c4 | 5 | public ListOrderedSet<String> matcher(CharSequence text) {
ListOrderedSet<String> strings = new ListOrderedSet<>();
Set<Object> reachable = new ReachableVertices(this.automata, 0).getReachable();
StringBuilder temp = new StringBuilder();
for (int i = 0; i < text.length(); i++) {
... |
23bd43f2-8b8f-4c42-a095-a21aa586dede | 6 | public void LaunchDropOff() {
// Prepare
String UserInput = null;
// Display the UI boilerplate
DisplayMenu("DropOff");
// Enter the UI loop
UserInput = readUI();
while ((UserInput != null) && (UserInput.compareToIgnoreCase("quit") != 0)) {
if (UserInput.compareToIgnoreCase("sw") == 0) {
// Load ... |
ac4eed59-228b-49f8-a3c6-c258f5e6d207 | 3 | public void deleteCheque(int chequeID) throws SQLException{
try{
databaseConnector=myConnector.getConnection();
stmnt=(Statement) databaseConnector.createStatement();
SQLQuery="DELETE FROM familydoctor.cheque WHERE chequeID="+"'"+chequeID+"'";
stmnt.executeUpdate(... |
d566382f-59cb-429b-b134-ece70a4d833c | 8 | public boolean readLineFromSocket()
{
try
{
if ((this.alReceivedLine == null) || (this.alReceivedLine.size() < 1))
{
return false;
}
this.inputLine = ((String)this.alReceivedLine.remove(0));
if (this.inputLine == null)
{
throw new SocketException("Socket A... |
2fe1df8c-e969-468f-b246-8d8d79a9f228 | 3 | public boolean equals(Object o) {
if (o == this)
return true;
if (o instanceof IntegerType) {
IntegerType other = (IntegerType) o;
return other.possTypes == possTypes && other.hintTypes == hintTypes;
}
return false;
} |
c5c59672-ce1a-439c-9753-988f4ab0a794 | 6 | public static int randomColor(int from, int to) {
if (from < 0) {
from = 0;
} else if (from > 255) {
from = 255;
}
if (to < 0) {
to = 0;
} else if (to > 255) {
to = 255;
}
if (from == to) {
return (0xFF000000 | (from << 16) | (from << 8) | from);
} else if (from > to) {
final int t... |
40e7a457-d175-49a8-b71a-c18ffab34590 | 5 | private void initConfig() {
System.out.println("Maggie: initializing configuration.");
// properties
Properties props = new Properties();
// new loader to load from disk instead of war file
String configfilename = "/springfield/homer/config.xml";
if (isWindows()) {
configfilename = "c:\\springfield... |
633726fa-b867-4ba2-be00-2b61e389a379 | 3 | void unload(final Chunk chunk) {
final Set<Region> unloaded = this.cache.remove(ChunkCoordinates.hash(chunk));
if (unloaded == null) return;
for (final Region region : unloaded) {
final long remaining = this.references.get(region);
this.references.put(region, remaining -... |
1fe148cb-c65e-43b8-9171-3c1f416de62c | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Tarefa other = (Tarefa) obj;
if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {... |
94af4d45-9562-4064-a083-55ed0c9b2cf8 | 7 | public static boolean disband(String[] args, CommandSender s){
// Various checks to prevent the guild creation from going through if it shouldn't happen
if(Util.isBannedFromGuilds(s) == true){
//Checking if they are banned from the guilds system
s.sendMessage(ChatColor.RED + "You are currently banned from ... |
f2ffd2f6-9b76-43fd-87e0-de15cf5a8597 | 2 | public static void tria()
{
double a, b, c = 0;
Scanner in = new Scanner(System.in);
System.out.println("Maximum angle must be less than 120.");
System.out.println(" - A triangle and its circles - \n");
System.out.print("First side: ");
a = in.nextDouble();
System.out.print("Second side: ... |
bae93442-2d0c-42f1-9392-5e2407b66c1f | 1 | private void closeOutput(){
try {
forefathersNodeFileWriter.write("結束時間: " + getRightNowTimeStr("/", ":", " ") + "\r\n");
leavesNodeFileWriter.write("結束時間: " + getRightNowTimeStr("/", ":", " ") + "\r\n");
leavesContentFileWriter.write("結束時間: " + getRightNowTimeStr("/", ":", " ") + "\r\n");
forefathers... |
e3770840-f319-465a-a285-ce5774e51657 | 6 | public double getAdsorbedChargeDensity(){
if(!this.sternOption || this.nonZeroAssocK==0){
return 0.0D;
}
if(this.psi0set && this.sigmaSet){
return this.adsorbedChargeDensity;
}
else{
if(this.sigmaSet){
this.getSurfacePotential()... |
59b6810b-946c-4c91-af03-b2d4e1fe0d01 | 8 | public void setOption(String opname, boolean b){
if(inmode != 2){
if(opname == "Ages"){ages = b; if(b == false){outmode = 1; fades = false; if(active){age = 1;}else{age = 0;}}else{outmode = 2;}}
if(opname == "Fades"){fades = b; if(b){ages = true;}}
}
if(opname == "Mirror"){mirror = b; if(b){hoodx... |
928ff835-e33f-4b4c-9d91-e99ef6174ad0 | 5 | public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String[] strings = input.nextLine().split(" ");
TreeMap<String, Integer> sequences = new TreeMap<>();
for (int i = 0; i < strings.length; i++) {
if (sequences.containsKey(strings[i])) {
sequences.put(strings[i], sequence... |
0a187bc3-7c9e-4d9b-958b-84c19da4b0a1 | 8 | public void toggleFullscreen()
{
try
{
this.fullscreen = !this.fullscreen;
if (this.fullscreen)
{
Display.setDisplayMode(Display.getDesktopDisplayMode());
this.displayWidth = Display.getDisplayMode().getWidth();
thi... |
ec7623c5-1a50-486c-880e-7d7cabf65a4f | 2 | public void solidify(GUIComponentGroup staticComponents, GUIComponentGroup dynamicComponents) {
if (!staticComponents.isSolidified()) {
staticComponents.solidify();
}
if (!dynamicComponents.isSolidified()) {
dynamicComponents.solidify();
}
this.staticCompo... |
a81b3a1d-28d5-428b-8f36-469f3b5e84de | 2 | public int widthInBytes() {
switch (arch) {
case X86_32:
return 4; // 4 * 8 = 32
case X86_64:
return 8; // 8 * 8 = 64
}
throw new IllegalArgumentException("Unknown architecture encountered: "
+ arch);
} |
dd87144d-acce-469a-99d9-ead3c1f4808e | 0 | @Override
public void setStartingPosition(Tile t) {
this.startingPosition = t;
} |
20f10c32-69d7-402a-9478-4d92627405e2 | 2 | public static String decode(String str) {
String[] tmp = str.split(";&#|&#|;");
StringBuffer sb = new StringBuffer("");
for (int i = 0; i < tmp.length; i++) {
if (tmp[i].matches("\\d{5}")) {
sb.append((char) Integer.parseInt(tmp[i]));
} else {
sb.append(tmp[i]);
}
}
return sb.toString();
} |
774331b1-7b34-4454-ad0d-87b7da025102 | 3 | @Override
public String print() {
if(Target == 0) return "Round " + RoundNum + ", Player " + Player + " (" + RunFileGame.getPlayerName(Player) + ") had no vision.";
String role = null;
switch (Vision) {
case WolvesUI.VISION_INNO:
role = "an innocent.";
break;
case WolvesUI.VISION_WOLF:
role = "a wer... |
27c489b8-5f51-47c9-b990-3cf2e3fa37d1 | 8 | public void sendReply(DHCPPacket request, byte requestType, byte[] reservedIP){
DHCPPacket reply = new DHCPPacket();
reply.setOp(Constants.BOOTREPLY)
.setHtype ((byte) 1)
.setHlen ((byte) 6)
.setHops ((byte) 0)
.setXid (request.getXid())
.setSecs (0)
.setBroadcastFlag(true)
... |
139a88f4-3598-4599-a107-72278fc4d1eb | 4 | private List<String> read_commands_from_file()
{
List<String> stroki = new ArrayList();
try
{
DataInputStream in = new DataInputStream(new FileInputStream("commands.txt"));
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;... |
8b428173-873d-44f4-8d7c-a50811cbbcb7 | 7 | private <T> List<T> queryForPojoList0(Class<T> pojoType, Map<String, Object[]> argsMap) {
String[] sqls = null;
List<Object[]> argsObjs = null;
if (pojoType.getAnnotation(ORMAutoAssemble.class) != null && pojoType.getAnnotation(ORMHash.class) != null) {
// 处理散列表,分SQL查询
SqlSelHashGenerator sqlGenerator = new... |
177dcbd3-c590-480b-b3c8-b2695f7edbdb | 1 | public void test_printParseShortName() {
DateTimeFormatterBuilder bld = new DateTimeFormatterBuilder()
.appendPattern("yyyy-MM-dd HH:mm ").appendTimeZoneShortName();
DateTimeFormatter f = bld.toFormatter().withLocale(Locale.ENGLISH);
assertEquals(true, f.isPrinter());
... |
ced0169c-515b-46ef-97e9-dce04f839dbe | 8 | public SpnegoPrincipal authenticate(final HttpServletRequest req
, final HttpServletResponse resp) throws GSSException
, IOException {
// determine if we allow basic
final boolean basicSupported =
this.allowBasic && (this.allowUnsecure || req.isSecure());
... |
0b6c4bf3-c720-4789-9b75-f02bb500dce6 | 5 | @Override
public void onProjectileHit(ProjectileHitEvent event) {
if(!(Properties.cooldown_on_damages_only)) {
Entity entity = event.getEntity();
if(entity instanceof Arrow) {
Arrow arrow = (Arrow) entity;
if(arrow.getShooter() in... |
ba8c6416-34c2-4050-94f8-6a2a009ea8a3 | 9 | void tick(){
if (playing) {
//handles speedboost powerup
if (speedTimer > 0)
speedTimer--;
else if (speedTimer == 0) {
Square head = square.get(square.size() - 1);
SQUARE_VELOCITY /= 2;
head.v_x /= 2;
head.v_y /= 2;
speedTimer--;
}
//Delete the last square and add a new one to ... |
6a2db275-0d46-45e4-a185-2ff43259a074 | 0 | private void jButton8ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton8ActionPerformed
{//GEN-HEADEREND:event_jButton8ActionPerformed
world.choiceMade("get");
// GemCount.setText("" + world.getPlayerGem());
}//GEN-LAST:event_jButton8ActionPerformed |
63e6de1f-15c4-4fa2-90b2-71d65fb72d6d | 7 | public HashMap<String, DataFile> getRepoFileData(
String repositoryName,
String baseUrl) throws IOException {
if (!repoDownloadLocks.containsKey(repositoryName)) {
// Create a lock object for this repo name if we don't already have one
repoDownloadLocks.... |
aa83da53-b5c7-4ede-b5c7-99c4ab4d3ffb | 7 | public static int getMaxSum(int[][] integers, int size) {
int maxSum = Integer.MIN_VALUE;
for (int row = 0; row < size; row++) {
for (int column = 0; column < size; column++) {
for (int rowEnd = 0; rowEnd < size; rowEnd++) {
for (int columnEnd = 0; columnEnd < size; columnEnd++) {
int sum = 0;
... |
f9ae0fc4-1193-4528-b394-3fe24275e47e | 4 | @Override
public void paint(Graphics g){
g.setColor(p.getBgcolor());
g.fillRect(0, 0, getWidth(), getHeight());
for(Iterator<Drawable> it = p.getDrawables().iterator(); it.hasNext();){
this.paintDrawable(it.next(), g);
}
if(p.getWorkingLayer() >= 0 && p.getCurrentTool() == -1){
Drawable figure = p.getD... |
cc4c69e7-850d-4cac-87bd-5e4e7d44a1d5 | 9 | public static void info_day()
{
String day = "";
Calendar cal = Calendar.getInstance();
int weekday = cal.get(Calendar.DAY_OF_WEEK);
switch (weekday)
{
case 1:
day = "sunday";
break;
case 2:
day = "monday";
break;
case 3:
day = "tuesday";
... |
dda77e5e-7389-4150-a77c-52a68de03d52 | 2 | public String getValue(String key) {
synchronized(settings) {
for (String k : settings) {
String finalk = k.split("=")[0].trim();
if (finalk.equalsIgnoreCase(key))
return k.split("=")[1].trim();
}
return "null";
}
} |
660565be-3c4f-40f3-a91c-5550763402ad | 2 | static double maxValueInArray(int[] N) {
double max = N[0];
int n = N.length;
for (int i = 0; i <= n; i++) {
if (N[i] > max) {
max = N[i];
}
}
return max;
} |
94b3623f-148e-462b-b114-d02289d9a0de | 3 | UserSession txLogoutExistingSession(Long userId) throws DuplicateUserEmailDetected {
Session session = HibernateUtil.getCurrentSession();
List<?> list = session.createQuery(
"from UserSession as us where us.user.id = :userId " +
"and (us.lastActivity+timeout) > :now")
.setLong("userId", userId)
.setD... |
1a0e0f49-6f21-4143-8948-e340092cdf8f | 5 | public void move(int i)
{
if (i >= movementSpeed)
{
return;
}
SnakePiece tail = getTail();
moveSnakePieces(createHeadWithNextPosition(direction));
if (isConsuming && growSize > timesGrown)
{
addTail(tail.x, tail.y);
timesGrown++;
if (growSize == timesGrown)
{
timesGrown = 0;
isC... |
938b6af1-5bc8-4605-b8a7-2ef4a7334fce | 0 | public final void identify(String password) {
this.sendRawLine("NICKSERV IDENTIFY " + password);
} |
e47f69a8-eda7-4529-91a9-80dacd90fdd3 | 7 | @Test
public void computeY() {
SimpleMatrix A = SimpleMatrix.random(2*r+2,2*r+2,-1,1,rand);
A = A.transpose().mult(A); // needs to be symmetric to pass
SimpleMatrix Vo = SimpleMatrix.random(r,A.numCols(),-1,1,rand);
for( int row = 0; row < r; row++ ) {
SimpleMatrix AA = ... |
6ae1a8f7-9d1f-4924-9cfb-6cc4fc8accce | 7 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=pro... |
3c36870b-3bcb-4be7-a998-a330ffcf9179 | 8 | public void mousePressed(MouseEvent e)
{
if(!loading && !updating && !saving && !verticalScrollbar.isSelected() && !horizontalScrollbar.isSelected())
{
overlay.mousePressed(e);
}
if(!updating && tm.getTiles().size()>0)
{
for(int i=0;i<tm.getTiles().size();i++)
{
tm.getTiles().get(i).mousePressed... |
e93f0256-783a-43eb-bc75-11dbc872ae63 | 0 | public static void main(String[] args)
{
MyTest test = new MyTest();
test.output();
} |
90c2eaee-384d-45aa-9045-9bd49f9f50ba | 2 | public Boolean isAdmin( Player p )
{
if ( p.isOp() || p.hasPermission( "iNations.admin" ) )
return true;
return false;
} |
506e17cd-a60e-44de-afa5-28718dad9172 | 9 | public static boolean isValidPosition(String pos) {
// TODO update this so that the position names are an enum, possibly
// TODO update this so that the position names are populated
// automatically by a query to league settings through API
if (pos.equals("QB") || pos.equals("RB") || pos.equals("WR")
|| pos... |
87b4667a-fcbc-4db3-a023-cb4d6811c064 | 8 | protected List<MutableElement> readElements() {
saveElementsData();
// die eingelesenen Elemente werden nicht alle vorgehalten, da dies auf Dauer zu viele werden können
final List<MutableElement> mutableElements = new ArrayList<MutableElement>();
try {
byte[] bytes;
if(_elementsFile.isFile() && _eleme... |
c579784c-76f9-4663-9d80-bc437c750ae8 | 1 | protected void _nextDistance() {
_setDistance(_forward ? Robot.vision.nextDistance() :
Robot.vision.prevDistance());
} |
f54607a9-3f35-4709-8b4c-43af1c78cf6e | 3 | public static boolean login(String charname) {
if (instance == null) return false;
Iterator<APXUtils.AccountInfo> iterator = APXUtils.accounts.values().iterator();
while (iterator.hasNext()) {
APXUtils.AccountInfo info = iterator.next();
if (info.login.equals(charname)) {
instance.wdgmsg("forget");
... |
c6dc03c1-1c5b-49e1-95e3-a6b75bb3f834 | 6 | private void setStateIfMinecartInteractsWithRail(World par1World, int par2, int par3, int par4, int par5)
{
boolean var6 = (par5 & 8) != 0;
boolean var7 = false;
float var8 = 0.125F;
List var9 = par1World.getEntitiesWithinAABB(EntityMinecart.class, AxisAlignedBB.getBoundingBoxFromPoo... |
528fa10e-db34-43e2-9dbf-efff22920807 | 4 | @EventHandler
public void onPaintingBreak(HangingBreakEvent event) {
if (event instanceof HangingBreakByEntityEvent) {
final Entity remover = ((HangingBreakByEntityEvent) event).getRemover();
if (remover instanceof Player) {
if (!plugin.canBuild((Player) remover)) {
event.setCancelled(true);
if (... |
71c3ea26-38c7-47fc-9d1e-ce0d6e330b62 | 0 | public String newGame() {
return games.createGame().getGameId().toString();
} |
1c497aca-5764-4382-8cc6-6cd1f6a3166b | 3 | public static ControllerType getControllerType(EntityType type) {
switch (type) {
case OBJ_TREE:
return ControllerType.TREE_CONTROLLER;
case OBJ_DOOR_WOOD:
return ControllerType.DOOR_CONTROLLER;
case ENTR_DUNGEON:
return Contro... |
34525f5b-e402-4d6f-85e1-f354a36c1787 | 5 | @Override
public boolean equals(Object obj)
{
//This implementation was auto-generated by eclipse
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Time other = (Time)obj;
... |
5f038481-d8f6-4215-be5f-35e6bce0be1b | 0 | public void setNumber(String number) {
this.number = number;
setDirty();
} |
e2d33b02-dec5-4afe-a893-ea2c9b1ab4ba | 3 | public void setVolume(float vol) {
if (vol < 0 || vol > 1)
logger.error(new IllegalArgumentException(),
"Can't set to invalid volume, ", vol, " for ", this);
masterGain = vol;
if (masterGainSupported) {
float newGainValue = minimumVolume + (volumeRange * masterGain);
masterGainControl.setValue(newG... |
5207518e-2da0-4f15-9282-88a75cbefa08 | 2 | public static final Manifest loadManifest(Class<?> theClass) throws IOException, URISyntaxException {
URI uri = theClass.getProtectionDomain().getCodeSource().getLocation().toURI();
File file = new File(uri.getPath());
URL url = file.isDirectory() ? uri.resolve(MANIFEST_FILE).toURL() : new URL("jar:" + uri.toASCI... |
4fb23b54-8b4f-4716-8bff-6d644af0127b | 5 | public void render(){
canvas.setColor(backColor);
canvas.fillRect(0, 0, width, height);
for(SnakePart s: snake){
s.render(canvas);
}
canvas.setColor(Color.BLACK);
for(int x = 0; x < wa; x++){
canvas.drawLine(x * 10, 0, x * 10, getHeight());
}
for(int y = 0; y < ha; y++){
canvas.drawLin... |
26842a46-df37-451f-9350-903f69f089fe | 6 | protected byte[] decrypt(RSAPrivateKey rsaPrivateKey, byte[] obj){
if (rsaPrivateKey != null) {
try {
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.DECRYPT_MODE, rsaPrivateKey);
return cipher.doFinal(obj);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (No... |
8e0e2259-a076-45a0-911e-3844c8882bdf | 3 | protected static int getChildInt(String str, Element elem) {
String str2 = getTextContent(str, elem);
if (null == str2 || "".equals(str2)||"null".equals(str)) {
return -1;
} else {
return Integer.valueOf(str2);
}
} |
7bd33358-c6d8-4c09-9f10-f36e390e28ce | 6 | private void setParams(PreparedStatement stm, Object[] params) throws SQLException {
for (int i = 0; i < params.length; i++) {
Object o = params[i];
if (o instanceof String) {
stm.setString(i + 1, (String) o);
}
if (o instanceof Integer) {
... |
cda5ccf2-1d27-4090-b4f8-a9b0fd058720 | 9 | public MMNode(MMNode parent, Tuple<Integer, Integer> move, Board board, String color) throws Exception {
this.move = move;
this.quality = -1;
this.children = new ArrayList<MMNode>();
if(move != null) {
board.makeMove(move, color);
}
this.parent = parent;
color = (color.equals("w") ? "b" : "w");
this.... |
395ad26d-eea2-4ca5-97af-bd46a8c0a535 | 7 | public static void main(String[] args) {
Server s = new Server(1337);
s.addMessageListener(Message.TYPE_CHAT, new MessageEventListener<STDMessage>() {
@Override
public void onMessage(STDMessage message) {
message.setPayload(message.getMessage().replaceAll("hello", "hello world"));
}
});
s.ad... |
ed018a3a-ca37-43d8-8076-ab927c5692f9 | 9 | public void decreaseKey(int i, int j, int key) {
if (key > getValue(i, j)) {
throw new IllegalArgumentException("key is bigger than current key.");
}
if (i== 0 && j == 0) {
setValue(i, j, key);
return;
}
int maxI = i;
int maxJ = j;
if (i > 0 && getValue(i - 1, j) > key) {
maxI = i - 1;
maxJ... |
6121563f-2b69-435d-99a6-e24369b3e793 | 3 | public static void main(String[] args){
Scanner in = new Scanner(System.in);
long x = in.nextLong();
long y = in.nextLong();
int n = in.nextInt();
long A[]=new long[10];
A[0]=x;
A[1]=y;
for(int i=1;i<8;i++){
A[i+1]=A[i]-A[i-1];
... |
f3e92a90-0858-4d99-b1d6-c66fed26a691 | 8 | private boolean r_instrum() {
int among_var;
// (, line 76
// [, line 77
ket = cursor;
// substring, line 77
among_var = find_among_b(a_3, 2);
if (among_var == 0)
{
... |
cf2427f2-3935-4792-a6eb-80419c5bb291 | 2 | public void enable() throws IOException {
// This has to be synchronized or it can collide with the check in the task.
synchronized (optOutLock) {
// Check if the server owner has already set opt-out, if not, set it.
if (isOptOut()) {
configuration.set("opt-out", ... |
33323dd0-694a-4bc1-bdc7-eb72cae9808e | 3 | @Override
public void multipleObjectsSelected(ObjectProperties object)
{
if (!pModel.isState(STG_DBLCLICK_SHOW_PROPERTIES))
{
if (pModel.getMultipleSelectionObjects().size() == 2)
{
selObjectsLabel.setText(LOCALIZER.getString(L_SELECTED_OBJECT));
... |
c524ebbe-0a34-43da-a261-615400f24346 | 2 | public void execute(Miner miner){
//if the miner is at the goldmine he digs for gold until he
//is carrying in excess of MaxNuggets. If he gets thirsty during
//his digging he packs up work for a while and changes state to
//gp to the saloon for a whiskey.
miner.addToGoldCarried(1);
miner.increa... |
ef0b348e-18ab-45fb-9b91-303a0615b710 | 3 | public void display(String title, String summary, String link) {
Stage window = new Stage();
window.initModality(Modality.APPLICATION_MODAL);
window.setTitle(bundle.getString("weather"));
window.getIcons().add(new Image(WeatherDialog.class.getResourceAsStream("/image/icon.png")));
... |
0fd873b0-d880-4a7d-8fb4-2ae78db5624f | 7 | public int minCut(String s) {
int len = s.length();
int D[]=new int [len+1];
boolean [][]P=new boolean [len][len];
D[len] = 0;
for(int i = 0; i < len; i++)
for(int j = 0; j < len; j++)
P[i][j] = false;
for(int i = len-1; i >= 0; i--){
D[i] =D[i+1]... |
cc505a67-c751-48d2-bcb0-046860e14480 | 3 | public String getSymbol() {
String re = "";
int x = this.getBegin();
if (x < this.getCad().length() && (this.getCad().charAt(x) + "").matches(this.getMatchOperacion())) {
re = re + this.getCad().charAt(x++);
this.setBegin(x);
}
return re.equals("") ? null ... |
e36db82c-4a3c-4358-a676-3969d0c9abe7 | 2 | public static int find(int array[], int left, int right, int key)
{
int index = -1;
for (int i = left; i <= right; i++)
if (array[i] == key)
return i;
return index;
} |
22aa9131-99a5-4f4c-8986-2aa22aab5fc5 | 8 | public static void main(String args[]) {
System.out.print("Enter a number: ");
Scanner scanIn = new Scanner(System.in);
Integer num = scanIn.nextInt();
int flag = 0;
for (int i = 2; i < num; i++) {
if (num % i == 0) {
System.out.println(num + " is not a Prime Number");
flag = 1;
break;
}
}... |
b77dfdfa-b4e1-4de1-9e2e-5b51ef275344 | 9 | public static void inOrderTraversal(BinaryTree<Integer> T) {
// Empty tree.
if (T == null) {
return;
}
BinaryTree<Integer> prev = null, curr = T, next;
while (curr != null) {
if (prev == null || prev.getLeft() == curr || prev.getRight() == curr) {
... |
e9f5462c-d86b-4789-be6c-235e0417a721 | 0 | public int getButtonCount() {
return buttons.size();
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.