method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e6eee8a1-97f4-4a4b-845f-4a7bff5b7fe5 | 3 | private void init() {
double minFraction = 1;
double maxFraction = 0;
for (Double fraction : stops.keySet()) {
minFraction = Math.min(fraction, minFraction);
maxFraction = Math.max(fraction, maxFraction);
}
if (minFraction > 0) {
stops.put(0.0,... |
cfe32b17-4a54-4a5d-aeba-37f22ba32ac4 | 1 | @Test
public void testTimeStep_ANNUAL_MEAN() throws Exception {
printDebug("----------------------------");
printDebug("Annual Mean: " + this.toString());
printDebug("----------------------------");
CSTable t = DataIO.table(r, "obs");
Assert.assertNotNull(t);
// 4 YE... |
a5eb62f0-f430-409e-bcaa-75b5ae30e397 | 3 | public synchronized int getAmount() {
int retVal = amount;
if (retVal != 0) {
if (state == STATE_RELEASED) {
amount = 0;
}
else if (behavior == DETECT_INITAL_PRESS_ONLY) {
state = STATE_WAITING_FOR_RELEASE;
amount = 0;
... |
a3f17d08-6a65-4a82-a98c-d51280047064 | 1 | @Override
public int attack(double agility, double luck) {
if(random.nextInt(100) < luck)
{
System.out.println("I just did a sonic blow!");
return random.nextInt((int) agility) * 2;
}
return 0;
} |
91bc4d26-a438-4857-8abb-058d74045aa7 | 3 | @Override
public boolean onCommand(CommandSender sender, org.bukkit.command.Command cmd, String[] args) {
if(!Commands.isPlayer(sender)) return false;
Player p = (Player) sender;
if(args.length != 1) return false;
if(PlayerChat.plugin.getConfig().getBoolean("CustomChannels.Enabled", true)) {
channel.crea... |
bd44adb5-68a8-4540-bdb9-f494da45f77c | 1 | public static void unpackConfig(int id) {
Animation.animationCache = new Animation[id + 1];
Animation.aBooleanArray643 = new boolean[id + 1];
for (int j = 0; j < id + 1; j++) {
Animation.aBooleanArray643[j] = true;
}
} |
75147497-1fba-49a5-bfe4-c01c0ac8e750 | 1 | @Override
public void actionPerformed(ActionEvent e)
{
if(g.isGameOver())
t.stop();
++seconds;
g.getForm().setTimer(String.valueOf(seconds));
} |
27327212-d729-4d0c-a9cf-5028c6050ea3 | 6 | public Spitter(TileMap tm, int startingAction, String s) {
super(tm);
this.s = s;
moveSpeed = 0;
maxSpeed = .3;
fallSpeed = 0;
maxFallSpeed = 0;
width = 30;
height = 26;
cwidth = 30;
cheight = 26;
health = maxHealth = 1;
damage = 1;
invincible = false;
spitDamage = 1;
spits... |
db9e405b-a607-44b5-bbc8-6e4864eb88fb | 5 | public void run() {
System.out.println("Client connected to socket: " + _socket.toString());
try {
_out = new PrintWriter(_socket.getOutputStream(), true);
_in = new BufferedReader(new InputStreamReader(_socket.getInputStream()));
String inputLine, outputLine;
GameLogic businessLogic = new GameLogic()... |
4d907f20-bfc7-4992-8d4f-abe001878ae0 | 3 | public ArrayList<String> generateSpaces(String docContents) {
ArrayList<String> tokens = new ArrayList<>();
docContents = docContents + " ";
char[] docChars = docContents.toCharArray();
StringBuilder currentToken = new StringBuilder();
boolean tokenFlag = false;
for (in... |
3aa43e83-f445-4f18-b7b0-996cfbcbbc9c | 5 | public <T> ObjectConstructor<T> get(TypeToken<T> typeToken) {
final Type type = typeToken.getType();
final Class<? super T> rawType = typeToken.getRawType();
// first try an instance creator
@SuppressWarnings("unchecked") // types must agree
final InstanceCreator<T> typeCreator = (InstanceCreator<... |
3d234cc5-18db-4942-b45e-f6c6699a196d | 0 | public void setCryptoModuleInfo(CryptoModuleInfoType value) {
this.cryptoModuleInfo = value;
} |
2e9f20b3-aff5-4ad6-bdd5-6e7a459718db | 9 | private boolean r_mark_suffix_with_optional_y_consonant() {
int v_1;
int v_2;
int v_3;
int v_4;
int v_5;
int v_6;
int v_7;
// (, line 153
// or, line 155
lab0: do {
... |
55fef293-cb1f-4993-a6aa-15c56f3f6a5d | 4 | public double getDistance(double similarity) {
double result = (1 - similarity); //default: linear distance measure
switch (TRANSFORM) {
case INVERSE:
result = (1 / similarity);
break;
case INVERSE_OFFSET:
result = (1 / similarity) - 1;
break;
case INVERSE_2_OFFSET:
result = (1 / simi... |
f877ea49-227e-44d8-90fa-d5efb5859fdc | 7 | @Override
public GASolution<int[]> mutate(GASolution<int[]> chr) {
int[] data = chr.getData().clone();
IRNG rand = RNG.getRNG();
if (rand.nextDouble() <= probability) {
data[0] = rand.nextInt(0, 256);
}
int size = data.length;
int n = size / 5;
for (int i = 0; i < n; i++) {
if (rand.nextDouble() <=... |
e41f0cbd-100d-4360-a7c8-62c14de73916 | 1 | public void setFirstElement(T newFirst) {
if (newFirst == null) {
throw new NullPointerException();
}
this.firstElement = newFirst;
} |
5584ec33-7350-4c1e-a408-0d26acfb1d5c | 3 | public static void DiscoArmor() {
GIGADISCOARMOR = Bukkit.getScheduler().scheduleSyncRepeatingTask(GChub.getPlugin(), new Runnable() {
private Random r = new Random();
@Override
public void run() {
Color c = Color.fromRGB(r.nextInt(255), r.nextInt(255), r.nextInt(255));
for(Player p... |
9f5f3c58-6f0c-48f2-aa26-abbbcac9005d | 4 | public static void chargeSocket(MultipleTalkServer server){
if(!isFull){
SocketsTCP s = new SocketsTCP();
server.socket.add(s);
try{
server.socket.getLast().setSocket(server.mainSocket.accept());
}catch (Exception err) {
JOptionPane... |
cc82722b-399c-47d6-9630-1919fad7dc06 | 0 | public String getName() {
return name;
} |
95e9e3fc-8c7f-4000-b063-b3399dd99432 | 9 | SystemObject directDuplicate(final ConfigurationObject object, ConfigurationObject duplicatedObject, final Map<String, String> substitudePids)
throws ConfigurationChangeException {
// das Objekt wird dupliziert (nur KonfigurationObjekte)
if(duplicatedObject == null) {
final String pid = substitudePids.get(ob... |
aefd67bf-6689-49ab-8096-5cac6c4f1b7a | 2 | public static String getPlayersIP( String player ) throws SQLException {
BSPlayer p = getSimilarPlayer( player );
String ip = null;
if ( p == null ) {
ResultSet res = SQLManager.sqlQuery( "SELECT ipaddress FROM BungeePlayers WHERE playername = '" + player + "'" );
while (... |
03e2907b-600c-421b-a193-e07e0855fa64 | 8 | @Override
public boolean equals(Object obj) {
if( obj instanceof PrimitiveFieldsModel ) {
PrimitiveFieldsModel compare = (PrimitiveFieldsModel)obj;
return (compare.longVariable == this.longVariable &&
compare.intVariable == this.intVariable &&
(Math.abs((compare.doubleVariable - this.doubleVari... |
1ff0d2f5-e355-4c0f-8029-3498b5a43032 | 2 | private void displayData(List<Bookmark> bookmarks) {
if (bookmarks.isEmpty()) {
logger.info("There is no data");
} else {
StringBuilder sb = new StringBuilder();
sb.append("\r\n\"bookmarks\" : {\r\n");
for (Bookmark bookmark : bookmarks) {
... |
2a373f14-fb63-4ee9-b41c-d78ac618eb3e | 6 | private JMenu getFichier() {
if(this.utilisateur==ISelectionUtilisateur.NOMS.BOB) {
this.getFichierBob();
}
if(this.utilisateur==ISelectionUtilisateur.NOMS.ALICE) {
this.getFichierAlice();
}
if(this.utilisateur==ISelectionUtilisateur.NOMS.EVE) {
this.getFichierEve();
}
if(IHM.reel) {
this.getF... |
c94001f3-7179-4436-86d9-98b00fa744d1 | 2 | public String getString(String entry) {
String result = map.get(entry);
if (result != null && result.charAt(0) == '$') {
return getString(result.substring(1));
}
return result;
} |
1ac16b94-8562-4c33-bd4c-f75745281233 | 7 | public Set<Coordinate> getLegalMoves(Coordinate startingCoord, Board board) {
Set<Coordinate> legalMoves = new LinkedHashSet<Coordinate>();
Set<Coordinate> possibleMoves = possibleMoves(startingCoord);
Set<Coordinate> threatenedSquares = board.findThreatenedSquares(color);
for (Coordinate endCoord : possibleMov... |
cb3031e3-87ea-4a44-9972-cbd6e2af016c | 5 | @Override
public void run() {
int waiting = 1;
this.w.getReady();
this.w.file(this.name);
this.w.cut(this.name);
while (waiting > 0) {
if (this.w.lock.isLocked() && (changed || waiting==1)){
System.out.println(this.name + " is waiting in queue for "+this.punching);
waiting++;
changed=false;
... |
a0349b63-bf53-47bf-a653-54197c56f5d1 | 4 | private Object getObject(JoinPoint joinPoint, MethodSignature signature, Scope scope, String parameterName) {
switch (scope) {
case PARAMETER : {
String[] parameterNames = signature.getParameterNames();
for (int i = 0; i < parameterNames.length; i++) {
if (parameterNames[i].equals(parameterName)) {
... |
2ef2a8bc-8a3b-4a2d-b065-fc75e73c10e4 | 2 | private void crossover(Chromosome chr1, Chromosome chr2) {
Pair crPointsChr1 = chr1.getCrossoverPoints(2);
Pair crPointsChr2 = chr2.getCrossoverPoints(2);
if(crPointsChr1 != null && crPointsChr2 != null){
List<Bin> genesFromChr1 = chr1.getGenesByDivision(crPointsChr1);
List<Bin> genesFromChr2 = chr2.getGen... |
eb6ce798-4771-4722-bfaa-02ab5b9a98fc | 1 | public synchronized void editar(int i)
{
try
{
new LocalView(this, list.get(i));
}
catch (Exception e)
{
}
} |
fb395e12-419b-4161-be31-0f7abffc8791 | 6 | public void draggArrow(MouseEvent e) {
if (this.leftArrow) {
if (e.getX() < this.positionXSlider) {
this.left.setLocation(this.positionXSlider);
} else if (e.getX() + this.buttonWidth > this.right.getX()) {
this.left.setLocation(this.right.getX() - this.... |
1615c1a6-b4b5-4d7f-8adf-f890f9464ae3 | 2 | public void testPropertyCompareToSecond() {
LocalTime test1 = new LocalTime(TEST_TIME1);
LocalTime test2 = new LocalTime(TEST_TIME2);
assertEquals(true, test1.secondOfMinute().compareTo(test2) < 0);
assertEquals(true, test2.secondOfMinute().compareTo(test1) > 0);
assertEquals(tru... |
5b6aaf6e-8147-438a-a60f-1b21bb1f0e98 | 9 | private void okAppButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okAppButtonActionPerformed
// TODO add your handling code here:
try {
appname = (String) appNameTextField.getText();
} catch (NullPointerException ne) {
dispose();
JFram... |
5b1fa473-678d-4d6a-b427-4ace190a035c | 8 | private void createHuffmanDecodingTables (final int alphabetSize, final byte[][] tableCodeLengths) {
for (int table = 0; table < tableCodeLengths.length; table++) {
final int[] tableBases = this.codeBases[table];
final int[] tableLimits = this.codeLimits[table];
final int[] tableSymbols = this.codeSymbols[... |
fc0766ab-55a9-4bf1-8af8-e7fcd689c71a | 6 | @Override
public void render (float delta) {
if (countdown <= 0) {
int i = MathUtils.random(0, 1);
System.out.println(Values.levelChange + " <------------------------------------------------------------------------------------ THIS");
Values.levelFloat += Values.levelChange;
boolean b = false;
if(Valu... |
02f27f9e-7abe-4ff7-adc1-db01815631af | 3 | public void setTypeAttributes(int type){
switch(type){
case 0:
potion = x.getSubImage(1, 0);
addImage(potion);
setZHeightFromIsoImage(potion);
setPosition(wPosition);
name = "healing";
healing_amount = 10;
shield_amount = 0;
speed_increase = 0;
duration = 0;
used = false;
pi... |
71720f1d-2770-4c80-b157-9142882934ea | 8 | private static List<PgConstraint> getNewConstraints(final PgTable oldTable,
final PgTable newTable, final boolean primaryKey) {
@SuppressWarnings("CollectionWithoutInitialCapacity")
final List<PgConstraint> list = new ArrayList<PgConstraint>();
if (newTable != null) {
if... |
f6a076f3-1efd-4bbf-a3a9-d795e668a4f0 | 7 | public EnvironmentResolver(String machineEnvironmentPropertyFile, String artifact)
{
if (machine!=null)
return;
artifactName = artifact;
try{
/*
* load the requested machine environment property file
*/
log.debug("loading machine environment properties file {}",machineEnvironmentPro... |
653ced86-78e2-4102-8da7-6b93b427df3f | 7 | public void setResolution(int w, int h){
if (w==0 || h ==0){
rawImage = null;
image = null;
}
//Create buffered image
if (w!= getWidth() || h!= getHeight()){
image = new BufferedImage(w,h,BufferedImage.TYPE_INT_RGB);
}
//create corresponding raw data
int scale = colorizer.getDownscale();
if ( ... |
62b9dfaf-2fb2-440a-af04-fa366390262a | 5 | public void completeRequest(Player p, OfflinePlayer otherP){ //p is the one that got sent the request
if(!requests.containsKey(p.getName())) requests.put(p.getName(), new ArrayList<String>());
if(requests.get(p.getName()).contains(otherP.getName())){
requests.get(p.getName()).remove(otherP.getName());
Friend ... |
ad33e92f-a9f8-4b31-a916-6bd06b7e1e89 | 7 | public OBJLoader(String filepath){
try{
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(filepath)));
String line;
while((line = reader.readLine()) != null){
String[] c = line.split(" ");
if(line.startsWith("f ")){
if(!c[1].contains("/")){//Vertex
triang... |
bfb29fa6-064b-47e8-ad91-a7e4a8867293 | 8 | public SemanticRec gen_addOp(SemanticRec left, SemanticRec addOp, SemanticRec right)
{
SemanticRec[] results = gen_cast(left, right); //generates casting operations if needed
Type resultType = getTypeFromSR(results[0]); //both sides should have equal types
String op = addOp.getDatum(0);
... |
fce1242e-d07f-463a-8a23-e10c22da584e | 0 | private File getRootDir() {
return rootDirs.get(0);
} |
3d6ffc4f-967d-4deb-8c6e-985b49cda1bd | 1 | private void initMenuBar(){
menuBar = new JMenuBar();
// menuBar.setBounds(0, 0, this.getWidth(), 21);
menuBar.setSize(this.getWidth(), MENU_BAR_HEIGHT);
//*********************Menu File************************
JMenu file = new JMenu ("File");
JMenuItem menuItemFileNew =... |
a240445b-bec2-46e1-9592-42b65332de00 | 3 | private int compare(String pattern,Suffix suffix)
{
int max = Math.min(pattern.length(), suffix.length());
for (int i = 0; i < max; i++) {
if (pattern.charAt(i) < suffix.charAt(i)) return -1;
if (pattern.charAt(i) > suffix.charAt(i)) return +1;
}
return 0;
} |
cf67ab7d-0415-4313-8cd7-9bb01089399a | 2 | public void registerCallback(ClientEventCallback callback,
String... channels) {
for (String channel : channels) {
ArrayList<ClientEventCallback> callbacks = new ArrayList<ClientEventCallback>();
if (_callbacks.containsKey(channel)) {
callbacks = _callbacks.get(channel);
}
callbacks.add(callback)... |
db101290-b732-4ee2-8e5e-3b7e6ff7a986 | 1 | public boolean copy(String zipPath, String outPath) throws IOException
{
Path path = fileSystem.getPath(zipPath);
if(!Files.exists(path))
{
return false;
}
Files.copy(path, Paths.get(outPath), StandardCopyOption.REPLACE_EXISTING);
return true;
} |
58b6aca5-65bb-477b-a371-c5b48982c34d | 4 | @Override
public boolean equals(Object obj) {
if (obj instanceof Codon && ((Codon)obj).getN1() == n1
&& ((Codon)obj).getN2() == n2 && ((Codon)obj).getN3() == n3) {
return true;
} else {
return false;
}
} |
d5412b07-f348-4664-ad5b-563022b08ef6 | 8 | public void execute() throws Exception {
if (getBefore() == null || getBefore().invoke(getContext(), this)) {
getContext().getStack().push(this);
int count = calcCount();
for (int i=0; i<count; i++) {
makeValues(i);
if (getBeforeSave() == null || getBeforeSave().invoke(getContext(), ... |
f2bfa589-b8df-4db0-9778-089741eac15f | 9 | public int getXR(){
if(xr!=-1)return xr;
if(under.isEmpty()){
int maxx = Integer.MIN_VALUE;
for(int i=0;i<4;i++){
if(piece[i][0]==h-1)maxx = Math.max(maxx, piece[i][1]);
}
return xr = maxx+1;
}
int x = Integer.MIN_VALUE;
for(int i=0;i<4;i++){
for(P p:under){
for(int j=0;j<4;... |
a22fe8cd-20b3-466a-8de5-6d1f2e6bcec9 | 4 | public void start() {
switch(this){
case START_LEVEL:
Animation.START_LEVEL_ANIMATION.start();
Game.gameField.setWalls(new ArrayList<Wall>());
Game.gameField.setBalls(Game.level.getBalls());
break;
case PLAY_LEVEL:
break;
case END_LEVEL:
Animation.END_LEVEL_ANIMATION.start();
break;
case ... |
1bc3e4f3-9b04-4b87-8ca3-d27879f60858 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Exploit other = (Exploit) obj;
if (vulnerability... |
63899625-f182-480f-a740-893d73ed5387 | 8 | @Override
public void extract() throws IOException {
StringBuilder builder = new StringBuilder();
char current = source().current();
while (Character.isDigit(current)
|| (current == '.' && builder.indexOf(".") < 0)
|| Character.isLetter(current)) {
builder.append(current);
current = source().next()... |
25a02bd1-fb8a-47e3-820f-5512a71f0630 | 8 | public void run() {
try {
// Record the current time.
long time = System.currentTimeMillis();
// Activate brain.
Move move;
try {
move = brain.getMove(getBoard().clone());
} catch (RuntimeException e) {
Core.LOGGER.log(Level.WARNING, brain.getName()
+ " threw an unchecked Ex... |
859eda23-2de8-4d1b-859e-1b4d234bf415 | 9 | boolean writeReferenceOrNull (Output output, Object object, boolean mayBeNull) {
if (object == null) {
if (TRACE || (DEBUG && depth == 1)) log("Write", null);
output.writeVarInt(Kryo.NULL, true);
return true;
}
if (!referenceResolver.useReferences(object.getClass())) {
if (mayBeNull) output.writeVarIn... |
722c7e3a-940c-47f0-93d5-fb9654f9a9c1 | 8 | public static int getLevenshteinDistance(String s, String t) {
if (s == null || t == null) {
throw new IllegalArgumentException("Strings must not be null");
}
int n = s.length(); // length of s
int m = t.length(); // length of t
if (n == 0) {
retur... |
1d77821e-6b96-4643-b40f-d78078c37676 | 2 | @Override
public String getOneCourseAsJson(long id) {
for(Course course : courses){
if(course.getId() == id){
return trans.toJson(course);
}
}
return null;
} |
a1c9f0bd-5981-456d-a19f-e5b959c7ad99 | 6 | public int getSum(int start, int end) {
if (this.start == start && this.end == end)
return sumVal;
int mid = (this.start + this.end) / 2;
if (start <= mid && end <= mid)
return left.getSum(start, end);
if (start > mid && end > mid)
return right.getSum(start, end);
return left.getSum(start, mid) + rig... |
55af571a-e606-4747-8d2a-d9d5ff010c5a | 9 | public static void main(String[] args) throws IOException {
Scanner in = new Scanner(System.in);
StringBuilder out = new StringBuilder();
while(in.hasNext()){
HashMap<String, Integer> subs = new HashMap<String, Integer>();
int max = 0, curSize = 0;
int n = Integer.parseInt(in.next().trim());
String d ... |
356796a9-3bd2-4b19-8e4c-c015e8be970e | 3 | /*package*/ static void init() {
defaultProperty = new Properties();
defaultProperty.setProperty("weibo4j.debug", "false");
defaultProperty.setProperty("weibo4j.source", Configuration.getOAuthConsumerKey());
//defaultProperty.setProperty("weibo4j.clientVersion","");
defaultProper... |
835fffd3-3e85-434f-b8ec-6a97e16f81f3 | 7 | public void actionPerformed (ActionEvent e)
{
String o = e.getActionCommand();
if (o.equals(Global.name("block.copy", "Copy")))
TD.copy(Start, End);
else if (o.equals(Global.name("block.begin", "Begin Block")))
{
TD.unmark(Start, End);
Start = TD.getposition(X, Y);
Start.oneleft();
if (End == nu... |
fbba519e-52ac-4fc0-b0c6-7f40ece625b8 | 3 | void tryEncodingDecl(boolean ignoreEncoding) throws java.lang.Exception
{
// Read the XML/Encoding declaration.
if (tryRead("<?xml")) {
if (tryWhitespace()) {
if (inputStack.size() > 0) {
parseTextDecl(ignoreEncoding);
} else {
... |
376833be-01fe-471e-aa72-e884ec2860e3 | 9 | static private boolean jj_scan_token(int kind) {
if (jj_scanpos == jj_lastpos) {
jj_la--;
if (jj_scanpos.next == null) {
jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
} else {
jj_lastpos = jj_scanpos = jj_scanpos.next;
}
} else {
jj_scanpo... |
3d320587-ee78-40b6-b99a-3239c0583a41 | 8 | public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setSize(500, 500);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLayout(new BorderLayout());
GridPanel gridPanel = new GridPanel();
frame.add(gridPanel, BorderLayout.CENTER);
gridPanel.setGridSize(3... |
70d788f1-5cec-45b5-abc7-b838609c134b | 6 | final void method3677(Canvas canvas) {
if (canvas != null) {
AbstractImageFetcher class348_sub31
= ((AbstractImageFetcher)
fetcherTable.get((long) canvas.hashCode()));
if (class348_sub31 != null) {
this.canvas = canvas;
Dimension dimension = canvas.getSize();
canvasWidth = dimension.width;
can... |
86351d2f-50f9-403f-8d35-0554328a54d9 | 5 | private void tryGetNext()
{
if(_hasNext)
{
if(_current == null)
{
if(this._source.hasNext())
{
T item = this._source.next();
try {
if(this._predicate.evaluate(item))
{
this._current = item;
}
else
{
this._hasNext = false;
}... |
f061f08c-5505-4cb3-908a-7c0b92c4fa7e | 3 | public Chunk(int ground) {
//sets the ground level
for (int x = 0; x < 30; x++) {
for (int y = 0; y < 20; y++) {
if (y < ground) {
chunk[x][y] = new Square(Type.DIRT);
} else {
chunk[x][y] = new Square(Type.AIR);
... |
668ba48f-9972-469b-8f22-b599a95d554c | 4 | public PaintMessage getMessage(String message) {
PaintMessage paintMessage = null;
String[] messageElements = message.split("\\s");
switch (messageElements[0]) {
case "LINE":
int x1 = Integer.valueOf(messageElements[1]);
int y1 = Integer.valueOf(messageElements[2]);
int x2 = Integer.valueOf(message... |
da9f8765-4bfe-4260-83a7-0cba84b11fdf | 5 | public void dispose() {
if (memoryManager != null) {
memoryManager.releaseAllByLibrary(this);
}
if (cacheManager != null) {
cacheManager.dispose();
}
if (refs != null) {
refs.clear();
}
if (lookupReference2ICCBased != null) {
... |
b7a44a66-3b4c-4e7f-90b8-50f6aa6ef61a | 3 | public static List<ExtendedField> getAllMappingsWithSuperclasses(Class<?> clazz) {
List<ExtendedField> fields = new ArrayList<ExtendedField>();
for (ExtendedField field : getAllFieldsWithSuperclasses(clazz)) {
if (field.hasEntityMapping()) {
fields.add(field);
}... |
63a8893f-8892-4fbe-baa5-56f42044b012 | 8 | public void addPossibleTargets(NPC glacor, Entity target) {
for (int regionId : glacor.getMapRegionsIds()) {
List<Integer> playerIndexes = World.getRegion(regionId)
.getPlayerIndexes();
if (playerIndexes != null) {
for (int npcIndex : playerIndexes) {
Player player = World.getPlayers().get(npcInde... |
c0c66beb-039a-4f2d-a50c-2dab029900d0 | 8 | static public Rational centrlFactNumt(int n,int k)
{
if ( k > n || k < 0 || ( k % 2 ) != (n % 2) )
return Rational.ZERO ;
else if ( k == n)
return Rational.ONE ;
else
{
/* Prop... |
5140eda3-4ffd-4ec4-8717-e91438772e15 | 6 | public String build() {
Class<GroupRequest> clazz = GroupRequest.class;
StringBuilder result = new StringBuilder();
try {
Field[] fields = clazz.getDeclaredFields();
for (int i = 0; i < fields.length; i++) {
if (fields[i].isAnnotationPresent(RequestParameter.class)) {
String title = fields[i].getAn... |
ca39be9a-3419-4b34-8863-d6c1ef1e6f28 | 8 | public static void dumpEnvironment(Class<?> clss, java.io.PrintStream strm)
{
if (strm == null) strm = System.out;
ClassLoader clssld = clss.getClassLoader();
strm.println("Class=:"+clss);
strm.println("ClassLoader="+clssld);
java.security.Provider[] secproviders = java.security.Security.getProviders();
... |
3d93b7d6-0cab-463d-bb82-585054a1f774 | 0 | public int getA(){
return acceleration;
} |
e837e9be-6374-4918-a235-7581e8fbf992 | 9 | private void replace(Node n1, Node n2, Integer date) {
int id = outView.indexOf(n1);
if( id < 0 )
{
System.err.println("Scamp.replace: node is not known");
return;
}
// removing n1
outView.remove(id);
if( outViewDates != null ) outViewDates.remove(id);
// inserting n2
if( n2 != null )
{
if( (date !... |
b65fd907-cf00-4288-9324-97b3a5b996de | 2 | public void addClassPath(String classPath) throws IOException {
//TODO 搞清JFinalClassLoader.addClassPath
if (initialized) {
if (!classPath.endsWith("WEB-INF/class/"));{
return ;
}
}
super.addClassPath(classPath);
} |
fb6e5a7a-abf9-44c4-970d-23e41c3dce05 | 1 | private static Map<String, Object> serializeList(List<Object> list) {
Map<String, Object> data = new HashMap<String, Object>();
data.put("T", "L");
data.put("class", list.getClass().getName());
List<Object> objList = new ArrayList<Object>(list.size());
for (Object o : list) {
... |
5222950c-8578-44a9-9ebd-e57c94eb0e4a | 3 | @Override
public void timerTaskHandler() {
if (this.moved != null) {
if (this.moved) {
this.movedCounter += 1;
if (this.movedCounter >= 2) {
this.moved = false;
this.movedCounter = 0;
}
}
... |
c4a6bc2d-3d4b-4eef-b80f-bc79d114d763 | 4 | private void addItem(Winkel winkel) {
String title = askTitle();
String id = askId();
Object choice = askType();
int basisPrijs = askBasePrice();
ProductType type = (ProductType) choice;
Product product = null;
try {
switch (type) {
case FILM:
product = new Film(id, title, basisPrijs);
break... |
fe0b737f-31d7-4c65-af72-7a1fe0e52850 | 2 | public static void assignByBirthday(){
Vector birthVec = vectorByBirthday(Students);
int count = 0;
Table t = (Table) DiningRoom.get(count);
while(!t.filled() && birthVec.size() > 0){
String stuID = ((Student) (birthVec.get(0))).getID();
t.addID(stuID);
birthVec.remove(0);
}
count++;
} |
4d9ae02d-7ffc-4c1b-999b-57a0062cb291 | 4 | public Coord getNextSquare(Direction d) {
int xMove = 0;
int yMove = 0;
switch(d) {
case UP:
yMove = -1;
break;
case DOWN:
yMove = 1;
break;
case LEFT:
xMove = -1;
break;
case RIGHT:
... |
97085165-e9f6-487e-b9bc-5bcf49cf6855 | 8 | @Override
public Class<?> getColumnClass( int column ) {
switch( column ){
case 0: return Integer.class;
case 1: return Integer.class;
case 2: return Integer.class;
case 3: return Integer.class;
c... |
5f8224f0-8d57-447d-9199-5a29a4b6aa36 | 8 | @Override
void toBinary(BinaryPropertyListWriter out) throws IOException {
switch (type()) {
case INTEGER: {
if (longValue() < 0) {
out.write(0x13);
out.writeBytes(longValue(), 8);
} else if (longValue() <= 0xff) {
... |
024b3c37-b00b-455e-be45-831976e0a0ea | 9 | public Player turno() {
//Se sortea el jugador que inicia
if (TurnoSw) {
Random ranjug = new Random();
int r = ranjug.nextInt(4);
switch (r) {
case 0:
temp = jug1;
break;
case 1:
... |
e816d114-9002-4a18-be66-11f18763939b | 2 | private static void intToNetworkByteOrder(int num, byte[] buf, int start, int count) {
if (count > 4) {
throw new IllegalArgumentException(
"Cannot handle more than 4 bytes");
}
for (int i = count - 1; i >= 0; i--) {
buf[start + i] = (byte) (num & 0xff);
num >>>= 8;
}
} |
6faab58f-f04b-4a01-aaf1-e84bb4b52092 | 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... |
764e97c2-985e-43be-bfbc-31f14220665f | 5 | private static int runToAddressOrNextInputFrameHiOrLoLimit(State initial, int joypadInputAdd, int limit, int... addresses) {
if (!curGb.onFrameBoundaries) {
int add = curGb.step(0, addresses); // end unfinished frame
if (add != 0)
return add;
}
if (initial == null)
initial = curGb... |
57f7c628-afa0-4cdc-aa75-2a06b8f1872e | 2 | public static boolean createProposal(Date expiration, String subject, String description, String priority, ArrayList<String> options) {
Integer priorityNum = Proposal.getPriorityLevel(priority);
ArrayList<Integer> votes = new ArrayList<Integer>();
ArrayList<Integer> comments = new ArrayList<Inte... |
7bfb59ef-1e61-414f-8684-9b9ffae7f52b | 3 | private ObjetGraal createObjectGraal(){
ObjetGraal o = null;
if(listeGraal.size()<4){
double x = Math.random();
for (int i=0; i<DefObjetGraal.length;i++){
if(x<= ((double)(i+1))/DefObjetGraal.length){
int j = objectNextFree(i,listeGraal);
o = new ObjetGraal(DefObjetGraal[j][0], Integer.parseInt... |
f067a68f-f035-4934-98dd-c0649302d6a1 | 6 | @EventHandler
public void SilverfishRegeneration(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getSilverfishConfig().getDouble("S... |
6803095f-55d8-4891-8f19-15cf127f2a9b | 5 | public Tbody(HtmlMidNode parent, HtmlAttributeToken[] attrs){
super(parent, attrs);
for(HtmlAttributeToken attr:attrs){
String v = attr.getAttrValue();
switch(attr.getAttrName()){
case "align":
align = Align.parse(this, v);
break;
case "char":
charr = Char.parse(this, v);
break;
... |
028c1efc-7b86-4f44-a520-73395b3ad0f0 | 7 | public int solution(final int[] input) {
final int N = input.length;
int candidate = 0;
int candidateIndex = -1;
int candidateOccurrences = 0;
for (int i = 0; i < N; i++) {
final int value = input[i];
if (candidateOccurrences ... |
e3bef00c-63a9-4819-b936-d6e824248164 | 0 | public void setRole(Role role) {
this.role = role;
} |
6c71fed3-4c97-425c-bf92-f2248e1f1a18 | 9 | @Override
public Object getValueAt(int rowIndex, int columnIndex) {
KundeBestillingDTOView kundebestilling = kundebestillingList.get(rowIndex);
Object value = null;
switch (columnIndex) {
case 0:
value = kundebestilling.getBestillingsNr();
break;
case 1:
value = kundebestilling.getKundeId()... |
82899ffa-c322-4bcb-b845-73a0fb5484a4 | 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... |
25a9937c-a34e-4a08-be0b-890dc0b61514 | 0 | public JValidTextField(Color validColor, Color errorColor) {
this.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
JValidTextField vTxtField = (JValidTextField) e.getSource();
vTxtField.check();
}
});
... |
c9035989-dfb9-48cb-bad5-cf71c3eb1eb5 | 8 | public String toSource(String className, Instances data) throws Exception {
StringBuffer result;
boolean[] numeric;
boolean[] nominal;
String[] modes;
double[] means;
int i;
result = new StringBuffer();
// determine what attributes were processed
numeric = new ... |
6bc43527-2021-460d-90a7-95ca002876d3 | 6 | public void sortColors(int[] A) {
int zeros = 0;
int ones = 0;
int[] B = new int[A.length];
// B = A.clone();
for (int i = 0; i < A.length; i++) {
B[i] = A[i];
if (A[i] == 0) {
zeros++;
} else if (A[i] == 1) {
ones++;
}
}
int red = 0;
int white = zeros;
int blue = zeros + ones;
... |
7fd1e32f-0450-465f-9df8-1b47c312b345 | 6 | private ConfigurationSerializable getSerializable(Class<?> type)
{
Constructor constructor = null;
for(Constructor c : type.getDeclaredConstructors())
{
if(c.getParameterTypes().length == 0)
{
System.out.println("Found valid constructor in serializabl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.