method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
ecc36ba8-ba29-43f1-a599-f60bfeb5af77 | 3 | public static void unpackConfig(Archive container) {
Stream buffer = new Stream(container.get("spotanim.dat"));
int len = buffer.getUnsignedShort();
if (SpotAnimation.spotAnimationCache == null) {
SpotAnimation.spotAnimationCache = new SpotAnimation[len];
}
for (int i = 0; i < len; i++) {
if (SpotAnimat... |
3dc08a37-87f4-4826-b9f8-097d1e496425 | 5 | private boolean checkDirection(GameBoard gb, int player, Coordinates coord, int x, int y) {
try {
Coordinates newCoord = new Coordinates(coord.getRow() + x, coord.getCol() + y);
if (gb.getOccupation(newCoord) == EMPTY) {
return false;
}
if (gb.getO... |
5d188c05-74fe-417e-b35b-0c027a6da6c4 | 7 | @Override
public void draw(Graphics g, Display d, int bottomPixelX, int bottomPixelY,
boolean drawHealth){
double percentMoved = count * 0.25;
// Tile coordinates of The Dude (x,y)
double x, y;
if(attacking == null) {
x = this.oldX + (this.x - this.oldX) * percentMoved;
y = this.oldY + (this.y - thi... |
65d781b6-6392-4fb2-9aab-6c41676a69b0 | 4 | public void addPosition(Position position) {
if (position == null)
throw new IllegalArgumentException("Position can't be null");
if (position.xCoordinate < 0 || position.yCoordinate < 0)
throw new IllegalArgumentException("The given position is invalid!");
otherPositions.add(position);
if (otherPosi... |
2a9ab14e-5b70-499f-b6eb-075a0c4a908c | 3 | public Teleport(int x, int y, boolean tagurpidi) throws SlickException {
this.x = x;
this.y = y;
this.tagurpidi = tagurpidi;
pildid = new Image[11];
if (!tagurpidi) {
for (int i = 0; i < pildid.length; i++) {
pildid[i] = new Image("disintegrate0" + i + ".png");
}
animation = new Animation(pildid,... |
1c569028-972f-4da9-a5b4-504c76efe72d | 0 | public void setUnit(Unit u)
{
unit = u;
} |
de762630-171c-4ec7-bd45-3e12e3172531 | 1 | @Override
public V get(K key) {
int elementIndex = findKeyIndex(key);
if (elementIndex == -1) {
return null;
}
return mapArray[elementIndex].getValue();
} |
24e8398a-73ee-4545-add5-ae14cadb1978 | 0 | @Override
public Bus driverBus() {
return new BmwBus();
} |
81e800bd-710d-4aa9-9dc6-3c47653a5a0c | 3 | public static Color textHighlight(int type){
//if the message is encrypted, compressed or both, add different backgrounds
switch(type){
case 1:
//compress
return new Color(206, 255, 185);
case 2:
//crypt... |
11f4d7b9-dc14-4cec-80cd-cc8ea087457e | 1 | private JButton getJButton0() {
if (jButton0 == null) {
jButton0 = new JButton();
jButton0.setText("ok");
jButton0.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent event) {
jButton0MouseMouseClicked(event);
}
});
}
return jButton0;
} |
77fdef98-ef9e-4f11-836e-098720c45dba | 7 | private String checkExists(String downloadName) {
File fx = new File(opt.getDownloadPath()+File.separator+downloadName+".mp3");
if (fx.exists()){
if (ifExist.equalsIgnoreCase("Overwrite")){
fx.delete();
return downloadName;
}else if (ifExist.equalsIgnoreCase("Skip")){
return null;
}else{
... |
5ff72bba-8dd8-41cf-87e0-d36123acd211 | 8 | private void expand1(byte[] src, byte[] dst) {
for(int i=1,n=dst.length ; i<n ; i+=8) {
int val = src[1 + (i >> 3)] & 255;
switch(n-i) {
default: dst[i+7] = (byte)((val ) & 1);
case 7: dst[i+6] = (byte)((val >> 1) & 1);
case 6: dst[i+... |
5f877100-1417-4406-8763-7391d8842671 | 1 | public void stop() throws BITalinoException {
try {
socket.write(0);
Thread.sleep(SLEEP);
close();
} catch (Exception e) {
throw new BITalinoException(BITalinoErrorTypes.BT_DEVICE_NOT_CONNECTED);
}
} |
f3f02776-9328-4ef5-9a57-6e56cd946fef | 0 | public static boolean isNum(String str){
return str.matches("^[-+]?(([0-9]+)([.]([0-9]+))?|([.]([0-9]+))?)$");
} |
f76dd4c9-6b43-488d-a784-3114802730e3 | 4 | public static double newtonRaphson(double x0, double epsilon, int cantIter, Funcion fun) throws Exception {
double x1;
int iter = 0;
x1 = x0 - (fun.f(x0) / fun.fd(x0));
while ((iter < cantIter) && (Math.abs(x1 - x0) >= epsilon)) {
x0 = x1;
x1 = x0 - (fun.f(x0) / ... |
c1fb4e19-8da5-403a-94f6-4550b9401043 | 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... |
db5ae2f6-0281-47bb-b5d7-a5c211e1bf9a | 8 | public List < AState > search()
{
if(!this.calculated)
{
this.stateOpened = 0;
List < AState > opened = new LinkedList < AState >();
AState current = this.map.getStartState();
long start = System.currentTimeMillis();
while(!current.isGoal())
{
current.setClosed(true);
List < A... |
1e0e4b11-584c-42d8-8810-e4679bc24b84 | 7 | public void makeVisible(Component com) {
if(TargetSet) {
return;
}
int ht = com.getHeight(), vy = com.y;
int WindowTransition = parent.TranselateY;
int ActualPosition = WindowTransition + vy;
if(ActualPosition + ht > y+height) {
... |
e61c076f-e588-4361-bc6b-63ed76fc0ea8 | 5 | private final String getChunk(String s, int slength, int marker)
{
StringBuilder chunk = new StringBuilder();
char c = s.charAt(marker);
chunk.append(c);
marker++;
if (isDigit(c))
{
while (marker < slength)
{
c = s.charAt(marker... |
f724fa62-3898-4190-8730-819879e37c6c | 1 | @Override
public AbstractActionPanel getAction() {
if ( owner.getSelected() ) {
return new ActionPanelWorker();
} else {
return new ActionPanelBlank();
}
} |
405a1359-c64c-4715-a8d4-e8db092e39a4 | 5 | private void updateVillainMissiles3() {
ArrayList<VillainMissile3> deadVillainMissiles = new ArrayList<VillainMissile3>();
for(int i = 0; i < villainMissiles3.size(); i++) {
VillainMissile3 v = villainMissiles3.get(i);
v.move();
if(CollisionDetector.isColliding(v, sc)) {
if(!sc.isShieldActive())
... |
62bf8ba7-e5d4-401a-9d83-2a8f4cf71217 | 2 | public ArrondissementVille find(int id) {
ArrondissementVille arrondissement = new ArrondissementVille();
try {
ResultSet result = this.connect.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY).executeQuery("SELECT * FROM eleve WHERE elv_id = " + id);
... |
b14954a9-31a2-44ca-bb9c-bc27c215ad1e | 7 | public static int tileColour(int[] bands, Raster r) {
final int[] co = new int[] {6,4,0,1,2,3,5,6};
int[] pCount = { 0, 0, 0, 0, 0, 0, 0 };
final int w = r.getWidth();
final int h = r.getHeight();
for (int x = 0; x < w; x++) {
for (int y = 0; y < h; y++) {
int[] hsv = argbToHSV(r, x, y);
// First c... |
994c6619-d7b1-4f64-8191-7555841f5bb4 | 8 | private void doRepeat()
{
// Repeat the previous 1, 4, 8, 16 beats
switch (REPEAT_STATE)
{
case BEAT:
if (OUTPUT_BEATS.size() >= 1)
{
LAST_BEAT = OUTPUT_BEATS.get(OUTPUT_BEATS.size() - 1);
OUTPUT_BEATS.add(LAST_BEAT);
DUR... |
5240f51b-6017-4860-adf7-2a01c0672025 | 9 | private void replicateCards(Card remoteCard, String typeofCard) {
if (typeofCard.equals("remotePlayer")) {
remoteCards.newCard(remoteCard);
pcardPanel.removeAll();
pcardPanel.add(playerlabel);
Iterator<Card> pscan = (player.inHand).iterator();
while (pscan.hasNext()) {
pcardPanel.add(new JLabel(p... |
c51a6e99-c3f9-412e-a78c-f25177f2325a | 1 | public void testToStandardMinutes() {
Period test = new Period(0, 0, 0, 0, 0, 6, 7, 8);
assertEquals(6, test.toStandardMinutes().getMinutes());
test = new Period(0, 0, 0, 0, 1, 6, 0, 0);
assertEquals(66, test.toStandardMinutes().getMinutes());
test = new Period(... |
7b9f359c-1ba3-41eb-b996-a8b0038ea4ab | 2 | public void startElement(String name)
{
stack.addFirst(name);
if (name.equals("module")) {
currentModule = org.analyse.main.Main.getModule(id.toUpperCase());
asiModuleHandler = ((FilterASIModule) (currentModule
.getFiltre("ASI"))).getASIHandler();
... |
aa2a3bd7-d3b7-4fb2-a1e1-c3f66af80326 | 5 | private Location findFood(Location location)
{
Field field = getField();
List<Location> adjacent = closestPrey(field.adjacentLocations(getLocation(), 2));
Iterator<Location> it = adjacent.iterator();
while(it.hasNext()) {
Location where = it.next();
Object ani... |
12b31940-c897-480f-bc81-ba7891ca3d21 | 9 | @Override
/**
* Returns a String representation of the Item.
*/
public String toString() {
StringBuilder returnString = new StringBuilder();
// Append quantity if it is there.
if (this.quantity > 0) {
returnString.append(this.quantity + " ");
}
// If has name, use it.
if (!this... |
818672bf-3567-45d6-8e33-7cf4c37a2077 | 4 | public void replaceBreakContinue(BreakableBlock block) {
java.util.Stack todo = new java.util.Stack();
todo.push(block);
while (!todo.isEmpty()) {
StructuredBlock[] subs = ((StructuredBlock) todo.pop())
.getSubBlocks();
for (int i = 0; i < subs.length; i++) {
if (subs[i] instanceof BreakBlock) {
... |
e1ca8356-c678-4e15-a0c4-85c757b4ae22 | 5 | private Boolean validParameterType(Class<?> type) {
if(type == int.class) {
return true;
}
else if(type == float.class) {
return true;
}
else if(type == String.class) {
return true;
}
else if(type == String[].class) {
return true;
}
return false;
} |
a99eb5d6-0641-47ea-92e6-7a19987c9a05 | 0 | @Basic
@Column(name = "FUN_ID")
public Integer getFunId() {
return funId;
} |
71c22216-f007-4956-aca4-4b005a174469 | 2 | public synchronized List<Turnstile> init() {
if (turnstiles == null) {
turnstiles = new MyArrayList<Turnstile>(NUM_TURNSTILES);
for (int i = 0; i < NUM_TURNSTILES; ++i) {
Turnstile turnstile = new Turnstile();
turnstile.connect(this);
turns... |
175d12b0-9c12-4da1-9c04-1722fa01bfb0 | 9 | Message receiveMessageFromSocket (FragmentProcessor fp, ByteArrayOutputStream baos) throws IOException
{
baos.reset ();
int currentOpcode = 0;
do {
fp.readHeader ();
if (!fp.mask)
throw new IOException ("unmasked fragment");
if (currentOpcode == 0)
{
if (fp.opcode != 0)
cur... |
439d7288-e44a-4ef6-8e9a-00da11c48499 | 4 | public int getNumMappedReads(String path){
int numReads = 0;
try {
TextFile filtSam;
if (alnFnamePattern.isEmpty())
filtSam = new TextFile(path.replace(fnamePattern, "accepted_hits.filtered.sam"), false);
else
filtSam = new TextFile(pat... |
d3814b3c-863a-4253-acb2-2127021105e4 | 4 | public List<List<Integer>> subsets(int[] s){
Arrays.sort(s);
int num = s.length ;
int total = (int)Math.pow(2,num);
List<List<Integer>> result= new ArrayList<List<Integer>>();
for(int i=0;i < total;i++)
result.add(new ArrayList<Integer>());
for(int i =0;i < n... |
500b04f0-b997-4e00-b70c-8a61e5e9e4f4 | 7 | public String nextString() throws IOException {
int p = peeked;
if (p == PEEKED_NONE) {
p = doPeek();
}
String result;
if (p == PEEKED_UNQUOTED) {
result = nextUnquotedValue();
} else if (p == PEEKED_SINGLE_QUOTED) {
result = nextQuotedValue('\'');
} else if (p == PEEKED_DO... |
0346aea2-94cc-4eae-bf65-8194059e4327 | 5 | @Test
public void gameIsOverWhenNoMorePlayers()
{
rp.resetGame();
boolean b1 = !rp.isGameOver();
rp.getEntities().addEntity(new TestRat());
rp.getScore().resetScore(rp.getPlayers());
boolean b2 = !rp.isGameOver();
for (int i = 0; i < Const.initialLifeAmount; i++)
... |
65960476-6601-4e3d-b979-dc2ad0d4efd2 | 9 | private void harvestColor(){
//OPCIONAL CREAR CLASE DE SOURCE TAMBIEN
switch(env.getMapObjectInPosition(positionX, positionY)){
case Environment.REDSOURCE:
if(currentColor == COLORRED){
if(capacity<amountToHarvest){
colorAmount = ca... |
2434ae99-8876-45f0-9d27-ec3354584e43 | 8 | private ValueMatcher buildValueMatcher(String str, ValueParser parser)
throws Exception {
if (str.length() == 1 && str.equals("*")) {
return new AlwaysTrueValueMatcher();
}
ArrayList values = new ArrayList();
StringTokenizer st = new StringTokenizer(str, ",");
while (st.hasMoreTokens()) {
String elem... |
10c52158-b373-49f1-83a3-d620138928f9 | 3 | private void registerButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_registerButtonActionPerformed
String password = new String(passwordField.getPassword());
String confirmPassword = new String(confirmPasswordField.getPassword());
if(password.equals(confirmPassword)){
... |
13ff5dde-4987-4049-806d-b86dd7eb8856 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
StudentContact other = (StudentContact) obj;
if (internalID == null) {
if (other.internalID != null)
return false;
} else if (!internalI... |
428d566d-b6ca-46d3-9e73-86f0ef2d9eca | 7 | private void doSignCommand(CommandSender sender, Command cmd, String label, String[] args) {
if(sender instanceof Player) {
ItemStack item = ((Player) sender).getItemInHand();
BookMeta meta = null;
Matcher titleMatcher = null;
if(item.getType() == Material.WRITTEN_BOOK) {
meta = (BookMeta) item.getIte... |
dfa8d32a-5334-472d-94cb-7b9377201c52 | 0 | public void handlePark(Park park) {
park.setManaged(true);
this.parkList.add(park);
} |
bd176104-6086-44fb-b465-b79ff128965e | 6 | public static String getByteString( byte[] bt, boolean pad )
{
if( bt.length == 0 )
{
return "null";
}
StringBuffer ret = new StringBuffer();
for( int x = 0; x < bt.length; x++ )
{
if( ((x % 8) == 0) && (x > 0) )
{
ret.append( "\r\n" );
}
//String bstr = Integer.toOctalString(bt[x]); // ... |
0280ef5a-25cb-46ea-a953-5422ddc34161 | 1 | public boolean replaceSubBlock(StructuredBlock oldBlock,
StructuredBlock newBlock) {
if (subBlock == oldBlock)
subBlock = newBlock;
else
return false;
return true;
} |
1ecf2bbf-5222-4679-83cd-ac5621cb168d | 1 | public List<Command> getCommands() {
List<Command> list = new ArrayList<>();
Match commands = rootElement.xpath("commands").children();
for ( Match command : commands.each() ) {
String name = command.attr("name");
String content = command.text();
list.add( new... |
3d52a7e2-93c8-447a-8f0f-603c9e8f9f70 | 4 | public void formGraph() {
a = new ArrayList<>();
for (int i = 0; i < size; i++) {
a.add(new HashSet<Integer>());
for (int j = 0; j < size; j++) {
if (i != j && matr[i][j] == 1) {
a.get(i).add(j);
}
}
... |
ca3da9fa-8264-45a1-9315-3d41b35de4bf | 0 | @Override
public void finalize() throws IOException {
fileWriter.close();
} |
fa66bb94-9fab-4181-9eb1-43258a956c80 | 1 | @Override
public void start() {
run = true;
if(firstStart) {
firstStart = false;
super.start();
}
} |
631413a4-2657-42e4-8043-2075afd54df3 | 1 | public void saveConfig(String configString, File file)
{
String configuration = this.prepareConfigString(configString);
try
{
BufferedWriter writer = new BufferedWriter(new FileWriter(file));
writer.write(configuration);
writer.flush();
writer.close();
}
catch (IOException e){e.printStackTrace... |
77fc23d5-205c-4bde-bc78-352e43dbead4 | 0 | public AlgorythmFile(String name, String type, File file){
algorythmName = name;
algorythmType = type;
algorythmFile = file;
} |
9703d095-ed19-4c2c-a024-59616b1b625f | 5 | public boolean registerCommand(ChunkyCommand command) throws ChunkyUnregisteredException {
if (command.getParent() == null) {
if (!registeredCommands.containsKey(command.getFullName())) {
registeredCommands.put(command.getFullName(), command);
registerSuperAliases(com... |
1012086d-ae96-4693-8019-08fd3332380a | 8 | public static boolean isValidSolution(Team heroes){
if(useBudget && heroes.getCost() > budget){
return false;
}
if(heroes.getDurability() < Helper.villains.getDurability())
return false;
if(heroes.getEnergy() < Helper.villains.getEnergy())
return false;
if(heroes.getFightingSkills() < Helper.villains... |
89e82214-68ee-480f-9572-0c733ed24132 | 9 | @Override
public void handle(IHttpRequest httpRequest,IHttpResponse httpResponse) throws IOException {
try{
String command = httpRequest.getParametro("command");
String[] comandi =command.split("_");
for (int i = 0; i < comandi.length; i++) {
String comando = comandi[i];
if(!comando.isEmpty()){
... |
cc944c85-2874-47f9-81a2-74f6d7468a8a | 0 | public byte[] getP() {
return p;
} |
3a4f9aba-35d0-4d89-a1f5-c978c529b499 | 9 | private void moveRow(Board b, int caller) {
int posNr = 0;
Position tmp = null;
int i, j;
int foundPos = -1;
i = 1;
j = 1;
while (j <= b.getHeight()) {
i = 1;
while (i + 1 <= b.getWidth()) {
if (b.isFree(i, j) && b.isFree(i + 1, j)) {
b.set(i, j);
b.set(i + 1, j);
foundPos = pos.s... |
1196a4b2-66a2-4954-aa06-5007153af892 | 6 | public void lancerMatchs() throws IOException, ClassNotFoundException, InterruptedException
{
ArrayList<Partie> match;
match = new ArrayList<Partie>();
for(int i=0;i<IA.size();i++)
{
for(int j=0;j<IA.size();j++)
{
if(i!=j)
{
... |
2ac63310-75e2-4599-8c9a-7badbec68110 | 1 | private byte[] writeDataIndex(DataIndex dataIndex) throws IOException, XmlException {
try {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
getPersister().write(dataIndex, outputStream, "UTF-8");
return outputStream.toByteArray();
}
catch (Ex... |
0f9a2cc2-5c0b-428a-995a-88e5fd3af843 | 1 | private int getLengthHelper(Node<T> node) {
if (node == null) {
return 0;
} else {
return 1 + getLengthHelper(node.getTail());
}
} |
7d73a755-de98-46bf-a038-60b5133e4218 | 1 | public void setLivePanel() {
if (livePanel != null) {
livePanel.set(mp3list.getSong());
}
} |
17627d0c-d6bf-4631-8563-5f729a3c6150 | 1 | public List<ClusterType> getCluster() {
if (cluster == null) {
cluster = new ArrayList<ClusterType>();
}
return this.cluster;
} |
df3dabdd-ba72-4e05-91c8-870d9236d334 | 4 | public void save(BufferedWriter out, Object object) throws IOException
{
IConfig config = (IConfig) object;
try
{
beginConfigTag(out);
for (Method method : config.getClass().getMethods())
{
if (method.getDeclaringClass().equals(Config.class))
{
writeStartTag(method.getName(), out);
o... |
3301ddc9-cd41-4f9d-b924-e5186854e15d | 9 | public void paint(Graphics g) {
BufferedImage image = new BufferedImage(SCREEN_W, SCREEN_H, BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = image.createGraphics();
super.paint(g2d);
if(loading) return;
synchronized(this){
int xOffset = getOffset(player.getColumn(), 13,COLUMNS);
int yOffset = ge... |
2ac103f6-5358-4c9d-9bbe-5571ff961f84 | 2 | public void print(int n)
{
if (n > 0)
{
for (int i = 0;i < n; i++)
System.out.print(" ");
}
System.out.print(intVal + " ");
} |
1cfd8936-8a83-430b-b068-58fe221fda4f | 7 | public void setLatestPreview(Object preview) {
if ((this.previewedThread != null) && this.previewedThread.isComplete()) {
this.previewLabel.setText("Final result");
Object finalResult = this.previewedThread.getFinalResult();
this.textViewerPanel.setText(finalResult != null ? ... |
8443957d-5a6b-4363-8c97-53ccef5a9b3c | 7 | public static void DoTurn(PlanetWars pw) {
// (1) Find my strongest planet.
Planet source = null;
double sourceScore = Double.MIN_VALUE;
for (Planet myPlanet : pw.MyPlanets()) {
// skip planets with only one ship
if (myPlanet.NumShips() <= 1)
continue;
//This score is one way of defining how 'g... |
6905a413-e1cd-4d0d-bd9d-cf69618d4530 | 8 | private boolean readRomanPageBackwards()
{
ArrayList<Character> saved = new ArrayList<Character>();
char token = prevChar();
// if ( token=='p')
// System.out.println("p");
int len = 0;
// saved leading newline chars
while ( token=='\n'||token=='\r' )
... |
16a2d9cb-1938-4087-909f-d755d7bc7a8f | 8 | public ScreenArea getMenuBounds() {
int color = 6116423;
Point mouse = Mouse.getMousePosition();
int x = mouse.x;
int y = mouse.y;
int lastX = 0;
int lastY = 0;
int lastXX = 0;
int lastYY = 0;
for(int i = 0; i < 200; i++) {
if(ImageTool.isInTolerance(color, ImageTool.getPixel(x, y), 0)) {
lastX... |
863df53e-1abf-4707-b2df-fd9695c7d7e7 | 2 | @Override
public void processInput(ByteBuffer buffer) throws IOException {
while (buffer.hasRemaining()) {
if (parse(buffer.get())) {
processRequest();
reset();
}
}
} |
5e69a863-eafe-40b4-b32f-1a84fcba1648 | 9 | private static boolean comparerTabProduitsCode
(Produit[] tab, int[] tabTest, int n) {
boolean pareil = true;
int i = 0;
try {
if (tab == null && tabTest == null) {
pareil = true;
} else if (tab != null && tabTest != null && tabTest.le... |
280536a2-3ef0-4435-9e11-97ecd4d2ccc2 | 5 | @Override
public boolean equals(Object object) {
if(!(object instanceof Edge<?>)) {
return false;
}
Edge<?> edge = (Edge<?>) object;
return from.equals(edge.from) && to.equals(edge.to);
} |
3d2189b6-166b-4449-9923-5434f05a9af6 | 8 | private void postPlugin(Plugin plugin, boolean isPing) throws IOException {
// The plugin's description file containg all of the plugin data such as name, version, author, etc
PluginDescriptionFile description = plugin.getDescription();
// Construct the post data
String data = encode("g... |
79af3499-6014-4dea-9ca3-000eede7207e | 8 | public IFilter buildFilterChain() {
List<Class<? extends IFilter>> list = getConfiguredFilters();
ListIterator<Class<? extends IFilter>> listIterator = list.listIterator(list.size());
IFilter innerFilter = null;
while (listIterator.hasPrevious()) {
Class<? extends IFilter> filterClass = listIterat... |
93f4b6df-de05-4288-a262-404572208e7c | 9 | public Vector AStarSearch(Agent agent) {
PQ openQ = new PQ();
// initialize a start node
Node startNode = new Node();
startNode.location = startLoc;
startNode.costFromStart = 0;
startNode.costToGoal = pathCostEstimate(startLoc, goalLoc, agent);
startNode.totalCo... |
c47f31c3-8d58-4e0d-b10f-8e4df0a0a04e | 6 | public Produtos buscaProdutos(int idProduto){
produtos = this.getProdutos();
this.getConectaBanco();
try {
if (this.getConn() != null || !this.getConn().isClosed()) {
this.getConn().setAutoCommit(false);
this.setStmt(this.getBuscaProdutos());
this.getStmt().setInt(1, idProduto... |
85487262-1c1c-43e4-95d5-cf9c2556670c | 0 | public static void cantPass(){
System.out.println("パスできません!おける場所があります。");
} |
68124c3a-a737-463b-a2f2-92b759f5271a | 1 | public Program() {
days = new Day[7];
for (int i = 0; i < 7; i++) {
days[i] = new Day();
}
} |
8025721a-e484-4ee3-8927-e2ebe0560c7c | 7 | private boolean method66(int i, int j, int k)
{
int i1 = i >> 14 & 0x7fff;
int j1 = worldController.method304(plane, k, j, i);
if(j1 == -1)
return false;
int k1 = j1 & 0x1f;
int l1 = j1 >> 6 & 3;
if(k1 == 10 || k1 == 11 || k1 == 22)
{
ObjectDef class46 = ObjectDef.forID(i1);
int i2;
int j2;
... |
fa507e50-e8e4-424f-9814-38c01e022078 | 4 | @Override
public boolean equals(Object otherObj)
{
if(this == otherObj) return true;
if(otherObj == null) return false;
if(getClass() != otherObj.getClass()) return false;
ExpressionItem other = (ExpressionItem)otherObj;
String val = value.toString();
retur... |
4cd6a16b-15c4-42d2-b44f-36cb39bbde9a | 0 | public UpdateListener(String message) {
this.message = message;
} |
e5e6f3e8-606f-473e-9c4b-e929c79eec16 | 7 | @Override
public void run()
{
try
{
nouvelleConnexion();
} catch (IOException e1)
{
System.err.println("Erreur E/S sur l'utilisation des flux lors d'une nouvelle connexion" + e1);
}
while (true)
{
try
{
byte code = fluxEntree.readByte();
if (code == DESACTIVE_BOUTON_PARAMETRE)
{
... |
bd400e59-44b4-4d79-9139-e48faf306d20 | 4 | public void setTime(){
if(morningTime){setInterfaceWalkable(65535);}
if(afternoonTime){setInterfaceWalkable(12416);}
if(eveningTime){setInterfaceWalkable(12418);}
if(nightTime){setInterfaceWalkable(12414);}} |
c9273017-c1ca-47d3-88e0-8ed7dc4b952e | 0 | public void create(Date bookingDate, Date checkinDate, Date checkoutDate, String status) {
this.setBookingDate(bookingDate);
this.setCheckinDate(checkinDate);
this.setCheckoutDate(checkoutDate);
this.setStatus(status);
} |
455de305-c9d5-43a1-9451-65c3447decb5 | 2 | public AbsenceValidator(String msg) {
if (msg != null && !msg.isEmpty()) this.msg = msg;
} |
f2adec9d-e384-4c03-8ed2-f8148c303bf8 | 2 | private void writeHref(JspWriter out) throws IOException {
if (href != null && !href.isEmpty()) {
out.write("href='" + href + "' ");
}
out.write(">");
} |
6e04fc2b-e49e-4b7c-89ac-4ac0c867c0ae | 9 | public static boolean checkArticle(String article){
if(!checkSemicolon(article)){
System.out.println("semicolon problem");
return false;
}
String[] fields = article.split(";");
if(fields.length!=4){
System.out.println("Format not accept");
return false;
}
if(fields[0]==null||fields[0].isEmpt... |
6d4fff2b-2f3a-4849-9698-5ea4dc497099 | 9 | protected Object[] handleRemove(Object[] cells) {
Set removedRoots = new HashSet();
if (cells != null && cells.length > 0) {
Set rootsSet = new HashSet(roots);
for (int i = 0; i < cells.length; i++){
if (getParent(cells[i]) == null && rootsSet.contains(cells[i])) {
removedRoots.add(cells[i]);
}
... |
090c6baf-e184-42b6-bfe6-649e23f51c0b | 1 | public static double scaleTMP(final int port, final int raw, boolean celsius){
double result = (((raw/getResolution(port))*VCC) - 0.5)*100;
if (!celsius)
// Convert to fahrenheit
result = result*((double)9/5) + 32;
return new BigDecimal(result).setScale(2, RoundingMode.... |
7f8697b3-79e3-4b1b-b154-36fc1c7695f7 | 9 | public static long getCastleMoves(int player, State4 s){
if(!s.kingMoved[player] && (!s.rookMoved[player][0] || !s.rookMoved[player][1])){
long moves = 0;
final long agg = s.pieces[0]|s.pieces[1];
if(!s.rookMoved[player][0] && (Masks.castleBlockedMask[player][0] & agg) == 0 &&
!maskIsAttacked(Masks.cast... |
c8cbc3bc-e156-4cd8-b163-0f1586e511b0 | 5 | public void checkCollisions()
{
for(int i = 0;i<world.entities.size();i++)
{
Entity e = world.entities.get(i);
if(e != this)
if(e != null && !alreadyCollisionsChecked.contains(e))
{
if(e.clipAABB().collide(clipAABB()))
{
e.onCollide(this);
this.onCollide(e);
}
e.alreadyCollisi... |
d5fd12b3-0ed9-47e7-9ee9-080b0fce14e7 | 1 | public String authenticate(String supplied) {
if(!supplied.equals(password)) {
return "Protection proxy: No access";
} else {
subject = new Subject();
return "Protection Proxy: Authenticated";
}
} |
691fceff-2199-4ea5-a5a9-e7a1ada40a94 | 3 | private static void putClasses(final List<File> classes, final File directory) {
for (final File file : directory.listFiles()) {
if (file.isDirectory()) {
putClasses(classes, file);
} else if (file.toString().endsWith(".class")) {
classes.add(file);
... |
ebbc4cac-04fc-4f16-92c4-acffc38fe47d | 2 | @Override
public String execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, LogicException {
String subcategory = request.getParameter(ParameterName.SUBCATEGORY);
String category = request.getParameter(ParameterName.CATEGORY);
PrintWriter out;
t... |
71017239-d0d6-46c4-8ce8-f1b3bcd4e094 | 6 | @Override
public void paint(Graphics g, Component game) {
if (gameState == GameState.RUNNING) {
// draw background
g.drawImage(background, bg1.getBgX(), bg1.getBgY(), game);
g.drawImage(background, bg2.getBgX(), bg2.getBgY(), game);
// draw tiles
paintTiles(g, game);
// paint projectiles
Arr... |
7e11f5b1-5865-4177-b1e3-80d396c4d000 | 0 | public ConcreteColleagueA(String name) {
super(name);
} |
41d4b4f4-d542-4dfd-bdc5-8b019c411dbf | 3 | @Override
public synchronized void beginW(Actor arg0) throws InterruptedException,
DeadLockException {
/*Si redacteur ou lecture ou nb minimal de lecture non atteint */
while(writers>0 || readers>0 || N_R>0){
wait();
}
writers++;
System.out.println("(REDACTEUR) L'Acteur n°"+arg0.ident()+" accède ... |
9d3f8afe-2da7-4057-9cda-5a56f76f2695 | 8 | private void findCDSSplitLocations(){
//There are no split locations if there is only one/zero CDS
if(CDS.size() < 2){
return;
}
//Forward strand
//The CDS are in nucleic acid lengths, but the code needs the lengths in amino acids, so each length must be divided by 3.
//Get the first CDS split locati... |
7dbbb09d-4142-4069-8984-65b192e2134c | 5 | private boolean checkWeight(Item item){
if (item == null){
int weight = 0;
for (Weapon weapon : weapons) {
weight += weapon.getWeight();
}
for (NormalItem object : inventory) {
weight += object.getWeight();
}
... |
29d91106-ddfd-47dd-82eb-2f18bd18aaef | 0 | protected String getProperty(String key) {
return properties.get(key);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.