method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
5fe0825e-df94-455d-87e6-1302f7eca759 | 8 | public T read(Timestamp currentDateTime) throws IOException {
Deal deal = new Deal();
int type = dataInput.readUnsignedByte();
if ((type & DealFlags.DATE_TIME.getValue()) > 0) {
lassMillis = DataReader.readGrowing(dataInput, lassMillis);
}
// Timestamp timestamp = Ut... |
f1efed04-13a5-4244-964a-d75583170122 | 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... |
ef1719fc-f2e4-4f6b-a523-af25faaaa8b7 | 1 | public List<Double> getKurtosisList() {
List<Double> result= new ArrayList<Double>();
double[] values= this.getKurtosisArray();
for (int i= 0; i< values.length; ++i) {
result.add(Double.valueOf(values[i]));
}
return result;
} |
a943ee77-fa32-4420-ad22-e1a8abc430fd | 7 | private BufferedImage getView() {
if (this.getWidth() > 0 && this.getHeight() > 0) {
// maps size in pixels
int mapSize = (mapImage_Scaled.getHeight());
// checks new position is valid
if (viewPort.x + this.getWidth() > mapSize) {
int moveXBy = viewPort.x + this.getWidth() - mapSize;
moveView(-m... |
8d5e6a35-ecff-45b0-93e4-655db06f5af7 | 5 | public void next()
{
i--;
if(i<0)
i=modtexts.length-1;
modname = modtexts[i].getName();
boolean gef=false;
for(Modinfo prop: proposals)
if(prop.getName().equals(modname)) gef=true;
if(!gef)next();
headl.setText(modname);
headl2.setText(modname);
if(geladen)
laden();
else neu=fa... |
b8630ed4-6471-49fe-afa1-46da2967ca8f | 4 | @Override
public void onDraw(Graphics G, int viewX, int viewY) {
if (X>viewX&&X<viewX+300&&Y>viewY&&Y<viewY+300)
{
G.setColor(c);
G.fillArc(((int)X-radius)-viewX, ((int)Y-radius)-viewY, radius*2, radius*2, 0, 360);
}
} |
51c069ea-3e6d-47bc-9cbc-cfca9446ca95 | 5 | public int getNoValidMoves(int player)
{
int cnt = 0;
if (player == 1)
{
for (int i = START_S; i <= END_S; i++)
{
if (board[i] > 0) cnt++;
}
}
else
{
for (int i = START_N; i <= END_N; i++)
... |
39ca87ea-d803-4101-b9cf-82eb66baf74b | 3 | public ArrayList<ArrayList<Integer>> generate(int rowIndex) {
ArrayList<ArrayList<Integer>> results = new ArrayList<ArrayList<Integer>>();
ArrayList<Integer> result = new ArrayList<Integer>();
if (rowIndex == 0)
return results;
result.add(1);
results.add(new Array... |
4aa70a9d-e67a-480c-bf2b-6a35f6b54001 | 6 | public EntityPlayer getClosestVulnerablePlayer(double par1, double par3, double par5, double par7)
{
double var9 = -1.0D;
EntityPlayer var11 = null;
for (int var12 = 0; var12 < this.playerEntities.size(); ++var12)
{
EntityPlayer var13 = (EntityPlayer)this.playerEntities.... |
d0414232-423f-43c4-ba8d-350baaf44553 | 5 | public boolean compare(Fechas f){
StringTokenizer cadena = new StringTokenizer(fecha, "/");
boolean res = false, exit = false;
StringTokenizer token = new StringTokenizer(f.getCadena(), "/");
while (token.hasMoreTokens() && cadena.hasMoreTokens() && !exit){
String tok = token... |
cdde61f5-5e82-4d0b-805f-8f45efcdee5d | 2 | *
* @throws IOException if a data communication error occurs
* @throws UnknownHostException if cyc server host not found on the network
* @throws CycApiException if the api request results in a cyc server error
* @throws RuntimeException if the return from Cyc is not a string
*/
public String converseS... |
56920b4f-fef0-4fa3-b9c6-f7c2fa07b9ef | 0 | public MicroscopeCaptureResponse() {
} |
797cd451-521b-4858-b57e-1176a473c347 | 7 | public static String replaceSection( String originalText, String replaceBegin, String replacementText, String replaceEnd )
{
StringBuffer sb = new StringBuffer( originalText.length() );
if( (originalText.indexOf( replaceBegin ) < 0) || (originalText.indexOf( replaceEnd ) < 0) )
{
return originalText;
}
in... |
d1f3a07f-3779-4d49-8a2a-acb3dcbb7dce | 8 | @Override
public void unInvoke()
{
if(canBeUninvoked())
{
if(affected instanceof MOB)
{
final MOB mob=(MOB)affected;
if((found!=null)&&(!aborted)&&(mob.location()!=null))
{
if(messedUp)
commonTell(mob,L("You've messed up salvaging @x1!",oldItemName));
else
{
Item baseS... |
4f446b55-eb7f-45d5-b765-8fc0c73799e8 | 3 | private Noeud noeudNonVisitePlusProche(List<Noeud> noeudsNonVus, List<Float> dist) {
int indexNoeud = -1;
float distMin = Float.POSITIVE_INFINITY;
for(int i = 0 ; i < noeudsNonVus.size() ; i++) {
if(dist.get(this.noeuds.indexOf(noeudsNonVus.get(i))) < distMin) {
distMin = dist.get(this.noeuds.indexOf(noeud... |
f24a696e-0290-4e24-8f52-fda28c414a84 | 0 | public void setAccount(SHSMemberEntity account) {
this.account = account;
} |
0004ad43-2f4e-49bd-aa7b-fdd2b92136d6 | 6 | private void setStateIfMinecartInteractsWithRail(World var1, int var2, int var3, int var4, int var5) {
boolean var6 = (var5 & 8) != 0;
boolean var7 = false;
float var8 = 0.125F;
List var9 = var1.getEntitiesWithinAABB(EntityMinecart.class, AxisAlignedBB.getBoundingBoxFromPool((double)((float)var2... |
8ac16a2d-41f7-489c-995d-380831c877a1 | 3 | private void _replaceToken(){
if(m_token.type == Tokenizer.TokType.NUMBER)
m_token.value = numer_terminal;
else if(m_token.type == Tokenizer.TokType.KWORIDENT
&& !(m_key_words.contains(m_token.value)))
m_token.value = variable_terminal;
//else if(m_token.... |
112b2aaf-7bd3-400b-9643-7547662d0ddc | 4 | public static void main (String[] args){
TiliaCollection collectionBlue = new TiliaCollection(100000,CreditChecker.BLUE_PROCESSING_THREAD);
Integer[] rew = collectionBlue.getRewards();
TiliaCollection collectionRed = new TiliaCollection(100000,rew,CreditChecker.RED_PROCESSING_THREAD);
GUI gui = new GU... |
b0cb10cd-9f8e-48aa-a9e1-cc0ec1f2913c | 2 | private Long getSmallestId() throws SQLException
{
StringBuilder statement = new StringBuilder(100);
statement.append("SELECT ");
statement.append(Defaults.ID_COL);
statement.append(" FROM ");
statement.append(sourceObjectTableName);
statement.append(" ORDER BY ");
statement.append(Defaults.ID_COL);
st... |
faec94c9-bf2a-482d-90de-c23236609e89 | 6 | @ChattingAnnotation(feature = "History", type = "method")
@Override
public String retriveChatHistory(String sender) {
String sCurrentLine = null;
String Allfile = null;
BufferedReader br = null;
try {
File file = new File("./ChatHistory.txt");
if (!file.exists()) {
file.createNewFile();
}
br =... |
9b364ef9-f7fb-4268-ac70-5bb4a3c4485d | 6 | */
public boolean isOrthogonal(mxCellState edge)
{
if (edge.getStyle().containsKey(mxConstants.STYLE_ORTHOGONAL))
{
return mxUtils
.isTrue(edge.getStyle(), mxConstants.STYLE_ORTHOGONAL);
}
mxEdgeStyle.mxEdgeStyleFunction tmp = view.getEdgeStyle(edge, null,
null, null);
return tmp == mxEdgeStyl... |
109250d4-5899-4718-9085-80e6b848dfc3 | 5 | public String toStringJava(){
String attributes="//Attributes list\n",methods="",defaultConstructor="",publicS="";
if(OBJECTTYPE.getName().equals("Class")){
publicS="public class ";
}
if(OBJECTTYPE.getName().equals("Interface")){
publicS="public interface ";
}
if(OBJECTTYPE.getName().equals("Abstract"... |
4e82ff43-d434-4f73-ad4d-9c0b2a0acd0b | 0 | @Override
public void setValue(Object o) {
// instance must encapsulate a ResizingByteBuffer
this.rawFrameContents=(ResizingByteBuffer) this.convertObject(o);
} |
16ae61bf-a5b5-4846-aee0-2e233426323a | 7 | int minDistance(Marker queryMarker, Markers markers) {
int minDist = Integer.MAX_VALUE;
for (Marker m : markers) {
// We don't care about these
if ((m instanceof Chromosome) || (m instanceof Intergenic) || (m instanceof Gene) || (m instanceof Transcript)) continue;
// Find closest marker that has a transc... |
5f2a0420-04b4-4377-872a-75908f251453 | 5 | public static <T> boolean equals(final Collection<T> collection1, final Collection<T> collection2) {
if (collection1.size() != collection2.size())
return false;
final Iterator<T> iterator1 = collection1.iterator();
final Iterator<T> iterator2 = collection2.iterator();
while... |
9a6bfba5-7e49-4dae-a97f-110621a88cfd | 1 | public void visitForceChildren(final TreeVisitor visitor) {
if (visitor.reverse()) {
array.visit(visitor);
} else {
array.visit(visitor);
}
} |
b0a834ba-3b64-416f-acd9-ab24cd5d444e | 3 | public boolean equals(final Object value) {
if (value == this) {
return true;
} else if (value instanceof BasicValue) {
if (type == null) {
return ((BasicValue) value).type == null;
} else {
return type.equals(((BasicValue) value).type);
}
} else {
return false;
}
} |
b94afe20-8f5a-4202-9837-dad7f4c781fd | 2 | public void trapFieldWrite(String name, Object value) {
Class jc = getClassMetaobject().getJavaClass();
try {
jc.getField(name).set(getObject(), value);
}
catch (NoSuchFieldException e) {
throw new RuntimeException(e.toString());
}
catch (IllegalAc... |
9fd0f7d6-9f99-426b-8601-723f446cb387 | 4 | public static void leerNumerosEnterosBajos(BufferedReader br) {
// variables
Scanner s = null;
int temp = 0;
try {
s = new Scanner(br); // para scannear solo un tipo de datos
while (s.hasNext()) {
if (s.hasNextInt()) {
temp = s.nextInt();
BigNumberException.checkearNumero(temp);
System... |
b0592537-7d9d-48bd-a297-21b9ee38aa4e | 3 | public JSONRPCRequest buildRPCRequest( Reader reader )
throws NullPointerException,
JSONSyntaxException,
JSONRPCException,
JSONException,
IOException {
if( reader == null )
throw new NullPointerException( "Cannot read JSONRPCRequest from null reader." );
// Create JSONRPCValu... |
5d2a85d8-04cd-4434-8087-62137d6c50cb | 4 | public void breakBlock(int x, int y, int z)
{
Level level = minecraft.level;
Block block = Block.blocks[level.getTile(x, y, z)];
boolean success = level.netSetTile(x, y, z, 0);
if(block != null && success)
{
if(minecraft.isOnline())
{
minecraft.networkManager.sendBlockChange(x, y, z, 0, minecraft... |
9da27a7a-9ec3-4b91-a459-96a865c63b34 | 5 | protected void renderSelected(Graphics g)
{
final int mouse = getSelectedTile(mMouseX, mMouseY);
final int mouseX = Tile.getX(mouse), mouseY = Tile.getY(mouse);
if (mouseX >= 0 && mouseY >= 0 && mouseX < mWidth && mouseY < mHeight)
{
mRenderer.renderSelectedTile(mouseX, mouseY, g);
for (int tile : mField... |
65376120-2f6e-4543-bb5b-77b2ce25af6a | 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 fe... |
d9720d33-139b-4aa7-b574-8c805d099b8d | 2 | public void setAll(double min, double max, double value)
{
if (min < max)
{
mmin = min;
mmax = max;
}
else
{
mmin = max;
mmax = min;
}
if (testValue(value))
mvalue = value;
else
mvalue = mmin;
recalcDifference();
} |
039495d4-94b4-4fe8-be5f-96d367812950 | 3 | public void removeBySpan(long startTime, long endTime) {
int startIndex = this.getIndex(startTime);
int endIndex = this.getIndex(endTime);
for (int i = startIndex; i < endIndex; i++)
{
if (i < 0 || i >= nSlot)
continue;
this.aIsAvailable[i] = false;
}
} |
be353663-fd52-45c9-ad17-25b6fa4c7322 | 8 | private void createCommand(Player player, String args[]){
if (args.length < 2 || args.length > 3){
player.sendMessage(Util.edit("Usage: /ci create <item name> <player>"));
return;
}
if (instance.hasPermission(player, Constants.CREATE_PERMS)){
if (instance.getItemHandler().getItemType().containsKey(args[1... |
d5ae07ad-7a42-4330-bfbb-dcc19b51e615 | 7 | public static String getTextureFile(int type) {
switch(type) {
case GRASS:
return "grass.png";
case DIRT:
return "dirt.png";
case STONE:
return "stone.png";
case WATER:
return "water.png";
... |
44c12dc3-da85-498a-8634-68b53d98d202 | 7 | @Override
public void visit(Page page) {
String url = page.getWebURL().getURL();
System.out.println("URL: " + url);
if (page.getParseData() instanceof HtmlParseData) {
HtmlParseData htmlParseData = (HtmlParseData) page.getParseData();
String text = htmlParseData.getT... |
6249a1e2-c640-4a1e-9862-adca9b60b66e | 5 | public void move(int keycode){
if(dead){
movement.setX(0);
this.animation = death;
return;
}
if (keycode == KeyEvent.VK_LEFT || keycode == KeyEvent.VK_A){
movement.setX(-STEP_SIZE);
this.animation = type.getAnimationLeft();
this.prevAnimation = animation;
}
else if (keycode == KeyEvent.VK_RI... |
700df9a8-7a9b-4c9a-a989-45c8ca5b0a61 | 5 | public void readResponse() throws IOException, InterruptedException, ClassPathOutOfSyncException {
Object readObject;
try {
readObject = readObject();
} catch (ClassNotFoundException e) {
throw new ClassPathOutOfSyncException(e);
}
if(readObject != null && readObject instanceof Transport) {
Transpor... |
10e92680-67ec-4de7-a8b1-a4f4cae04a15 | 1 | public void close() throws IOException {
if (br != null) {
br.close();
}
} |
62eaf21e-c73c-43bd-9a08-219f4dcfb111 | 0 | public ITicketPool getPool(TicketQueryArgs args)
{
String key = args.getTrainNumber() + "|" + args.getDate().toString();
return this._pools.get(key);
} |
f85481dc-c85a-4de6-a244-87c763f8aa65 | 8 | public String getName(short entropyType)
{
switch (entropyType)
{
case HUFFMAN_TYPE:
return "HUFFMAN";
case ANS_TYPE:
return "ANS";
case RANGE_TYPE:
return "RANGE";
case PAQ_TYPE:
return "PAQ";
case FPAQ_TYPE:
... |
b995c50e-5474-40b5-9ac7-f74bde36d446 | 9 | protected void loadFields(com.sforce.ws.parser.XmlInputStream __in,
com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException {
super.loadFields(__in, __typeMapper);
__in.peekTag();
if (__typeMapper.isElement(__in, CreatedBy__typeInfo)) {
... |
623e311c-d2c1-4762-87ee-ee8e12b33abd | 4 | private static void printAllPermutations2(char[] str) {
Set<String> sofar = new HashSet<String>();
sofar.add("" + str[0]);
for (int i = 1; i < str.length; i++) {
Set<String> toAdd = new HashSet<String>();
for (String s : sofar) {
for (int k = 0; k <= s.length(); k++) {
toAdd.add(s.substring(0, k) +... |
3bfa0182-80aa-453b-8816-e662776436c2 | 5 | private void searchSelectedTower(int x, int y){
PointI p = transformPointBack(x, y).getPointI();
for(Tower t:level.towers){
int n = t.def.size;
PointI pt = t.getPointI();
if((p.x >= pt.x) && (p.x < pt.x + n) && (p.y >= pt.y) && (p.y < pt.y + n)){
selectedTower = t;
return;
}
}
selectedTower ... |
807ff1cc-acc1-4839-8ea6-37742bd564d5 | 6 | public static ArrayList<Monster> getMonster(int room, int numMons) {
//Generates a random monster
ArrayList<Monster> monsters = new ArrayList<Monster>();
for(int i = 0; i < numMons; i ++){
int type = 999;
Random randomGenerator = new Random();
randomGenerator.nextInt(100);
type = randomGenerator.ne... |
1ac54f69-50f4-4a48-bb3e-d279248b7308 | 2 | public int numberOfScores() {
File file;
file = new File("Scores.txt");
Scanner scanner;
int numberofScores = 0;
String line = "";
StringTokenizer scoreData;
try {
scanner = new Scanner(file);
while(scanner.hasNextLine()) {
line = scanner.nextLine();
users.add(line);
line = scanner.nextL... |
acf37527-4493-4f2f-ba9e-2310389ee16f | 7 | public static int getLevenshteinDistance1 (String s, String t)
{
int d[][]; // matrix
int n; // length of s
int m; // length of t
int i; // iterates through s
int j; // iterates through t
char s_i; // ith character of s
char t_j; // jth character of t
... |
27ee7ef1-1d98-49ca-80e6-e494419d34fa | 8 | @Override
public void unInvoke()
{
final Physical P=affected;
super.unInvoke();
if((P instanceof MOB)&&(this.canBeUninvoked)&&(this.unInvoked))
{
if((!P.amDestroyed())&&(((MOB)P).amFollowing()==null))
{
final Room R=CMLib.map().roomLocation(P);
if(!CMLib.law().doesHavePriviledgesHere(invoker(), ... |
b926dff3-c76f-4f22-8d78-7bc3ac6953b4 | 7 | public void update() {
//Crear archive random llamado nomina
try
{
RandomAccessFile miArchivo=new RandomAccessFile("ArchivoBinario.dat","rw"); // rw significa que el archive se podrá leer y escribir
//inicializando variables para leer los datos de teclado
St... |
ceb59ca5-568d-4eeb-8a44-d6327c87da7b | 4 | @Override
public void getMouseEvent(int button) {
if (button == 0 && !oldmouse){
double distance = PointMath.distance2Points(parent.getMapX(), parent.getMapY(), Boot.getPlayer().getX(), Boot.getPlayer().getY());
if (distance < 2){
parent.setSolid(!parent.isSolid());
int oldmeta = parent.getMetadata();
... |
944eba6c-891f-4a51-8662-689ac5aab20b | 8 | public KismetConnection(String host, int port) throws IOException {
socket = new Socket(host, port);
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
out = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
out.write("!0 REMOVE TIME\r\n... |
f74cfd27-acda-4e07-88d7-3f39006fb77a | 4 | public void update() {
up = keys[KeyEvent.VK_UP] || keys[KeyEvent.VK_W];
down = keys[KeyEvent.VK_DOWN] || keys[KeyEvent.VK_S];
left = keys[KeyEvent.VK_LEFT] || keys[KeyEvent.VK_A];
right = keys[KeyEvent.VK_RIGHT] || keys[KeyEvent.VK_D];
} |
2fd622f2-5028-4fb0-88d4-6e8cee7c1f76 | 1 | public void testWithField2() {
YearMonthDay test = new YearMonthDay(2004, 6, 9);
try {
test.withField(null, 6);
fail();
} catch (IllegalArgumentException ex) {}
} |
2f3b2b02-f349-4892-b664-b0676e744705 | 1 | public boolean isReceive(){
if(NBcell<Constantes.MAXDATA) return true;
else return false;
} |
73081afc-03e9-4606-99cd-67f71fd4857c | 2 | public void stop() {
if ( _started ) {
try {
// EventBus如果没有正常关闭,打个日志好了
EventBus.shutdown();
} catch ( Exception e ) {
// TODO: 记录EventBus无法正常关闭的日志
}
stopNettyServer();
}
} |
6b4c02c8-e986-4ede-b0bb-7391d29c1c18 | 9 | ArticleSelector(final CaisseControler controller) {
this.controller = controller;
this.controller.addCaisseListener(this);
this.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.gridx = 0;
c.gridy = 0;
c.weightx = 1;
c.fil... |
711f68e3-fc2d-4c07-af87-e1a54b4a56ad | 9 | public static void main(String[] args) {
ServerSocketChannel serverChannel;
Selector selector;
try{
serverChannel = ServerSocketChannel.open();
ServerSocket ss = serverChannel.socket();
InetSocketAddress addr = new InetSocketAddress(DEFAULT_PORT);
ss.bind(addr);
serverChannel.configureBlocking(fal... |
3cf880d6-4412-4caf-9c60-53f2e7d85ba7 | 8 | public void openFileAction() {
int nA, nO;
int i, selected;
String sName;
NSObject o;
NSRelation or;
TclSnippet s;
JFileChooser fch = new JFileChooser(this.lastpath);
fch.setDialogTitle(Messages.tr("script_open"));
selected = fch.showOpenDialog(th... |
3d24c405-6443-43d9-b999-a6387927a1f7 | 0 | public WebPages(){
docCount = 0;
termIndex = new BST();
} |
3548f963-4ac0-4c11-8160-4b19e639222b | 6 | public int match_main(String text, String pattern, int loc) {
// Check for null inputs.
if (text == null || pattern == null) {
throw new IllegalArgumentException("Null inputs. (match_main)");
}
loc = Math.max(0, Math.min(loc, text.length()));
if (text.equals(pattern)) {
// Shortcut (pot... |
d104f88e-0c2d-48a4-9f3e-c144310ef8c6 | 9 | public void recalc_matches() {
try {
int non_matches_map = 0;
int non_matches_file = 0;
int map_index = comboBoxMapLayer.getSelectedIndex();
int file_index = comboBoxFileLinkColumn.getSelectedIndex();
if( map_index < 0 || file_index < 0) {
System.out.println("recalc: bad index");
return;
}
... |
e9890c34-b369-4a68-b600-ae85ad921747 | 0 | public static void main(String[] args) {
Ex2 x = new Ex2();
} |
4addc078-38ab-40f5-ae60-e21220eba4ec | 9 | @Override
public double[] calculateJulia3DWithoutPeriodicity(Complex pixel) {
iterations = 0;
double temp = 0;
Complex tempz2 = new Complex(init_val2.getPixel(pixel));
Complex[] complex = new Complex[3];
complex[0] = new Complex(pixel);//z
complex[1] = new C... |
a4fef25c-df5e-4285-bef1-e70497a50118 | 3 | @Test
public void testItemGen() {
Item testItem = new Item();
boolean itemName = false;
if(testItem.getName().equalsIgnoreCase("Potion") ||
testItem.getName().equalsIgnoreCase("MagicStone") ||
testItem.getName().equalsIgnoreCase("UltimaStone")){
itemName = true;
... |
f7f9cc1a-e81c-43e2-9837-1a7cf64b967f | 9 | public void viewTicketsMenu() {
//===================== Local Data ======================//
boolean quit = false;
//wrap in do while to allow repetition of menu
do {
//if logged in user is a standard user, get a list of all tickets
//assigned to him/her
... |
c402dd8f-92ef-4db6-a52c-f3a27fb78b1e | 6 | private synchronized SSLContext ctx() {
if(ctx == null) {
TrustManagerFactory tmf;
KeyManagerFactory kmf;
try {
ctx = SSLContext.getInstance("TLS");
tmf = TrustManagerFactory.getInstance("PKIX");
kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
KeyManager[] kms = nul... |
354ddffd-bd94-44ed-810b-aeb4376676e0 | 8 | public double evaluateSubset (BitSet subset) throws Exception {
int [] fs;
int i;
int count = 0;
for (i=0;i<m_numAttribs;i++) {
if (subset.get(i)) {
count++;
}
}
double [] instArray = new double[count];
int index = 0;
fs = new int[count];
for (i=0;i<m_numAttribs;i++) {... |
feb65256-7e0d-49f2-a9de-0ec4c374a925 | 6 | public void solve() {
if (solved) {
System.out.println("Sudoku Puzzle already Solved!");
return;
}
if (board == null) {
System.out.println("No Puzzle Loaded");
return;
}
extractCandidates();
solved = (solved) ? solved : nakedQuadSolver(new LinkedList<NakedCandidates>(), new LinkedList... |
43bace03-9556-421c-bafc-220e5fc940d2 | 7 | public void set_nation(String nation){
this.nation=nation;
switch (this.nation){
case "all":
this.nation_nr=0;
break;
case "American":
this.nation_nr=1;
break;
case "British":
this.nation_nr=2;
break;
case "German":
this.nation_nr=3;
break;
case "French":
this.nati... |
31eb9db4-2d79-4dce-894b-8b79f168147e | 2 | public void readFromUser(BinarySearchTree<String, String> tree, int size) {
Scanner inn = new Scanner(System.in);
String compare ="N";
String comText= null;
String name = null;
String roll = null;
do {
System.out.println("\nEnter the fullName and rollNo as (DW-2XX):");
nam... |
949d7763-b8b6-47ed-9771-7c8d6f94faa4 | 9 | public static Cons helpDefineKeywordAxioms(Symbol selfname, Keyword key, Stella_Object value) {
{ Cons axioms = Stella.NIL;
Symbol relationname = Symbol.internSymbol(key.symbolName);
if (Stella_Object.symbolP(value) &&
Stella.stringEqualP(((Symbol)(value)).symbolName, "TRUE")) {
axiom... |
c4f82753-dbd4-4715-ae14-26983389d2a2 | 5 | private void getNextChangingElement(int a0, boolean isWhite, int[] ret) {
// Local copies of instance variables
int[] pce = this.prevChangingElems;
int ces = this.changingElemSize;
// If the previous match was at an odd element, we still
// have to search the preceeding element.
// int start = lastChanging... |
9dbd20b3-e3be-48bc-a0a4-25d6a5e1a9aa | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof ModelProperty)) {
return false;
}
ModelProperty other = (ModelProperty) object;
if ((this.modelPropertyPK == nu... |
ac00963f-7273-4573-88fe-a93953c5e932 | 8 | public static void main(String[] args) {
boolean doPrint = false;
// Make sure they specified a File and Algorithm to use
if (args.length < 2) {
usage();
System.exit(1);
}
int idx = 0;
if (args[idx].equals("-p"))
{
doPrint = true;
idx = 1;
}
// get the filenames for those
String d... |
46b2f7e2-4419-47b9-a544-86ea5a6a8428 | 7 | public int compare(Object obj1, Object obj2) {
String name1 = null;
String name2 = null;
if (obj1 instanceof Product) {
Product pro1 = (Product) obj1;
name1 = pro1.getName();
} else {
System.out.println("类型转换错误!");
}
if (obj1 instanceof Product) {
Product pro2 = (Product) obj2;
name2 = pro... |
633d0afd-a94c-4cb2-9974-b207a7565719 | 8 | public void advanceState(){
for(int y = 0; y <= ysiz-1; y++){
for(int x = 0; x <= xsiz-1; x++){
switch(mothership.getOpMode()){
case 1: mothership.state[xmin+x][ymin+y] = bintoInt(convertBin(newstate[x][y])); break;
case 4: mothership.state[xmin+x][ymin+y] = newstate[x][y]; break;
case 5: if(culture[x... |
426f64ce-5dd4-4ab4-95ed-361cd1bbad3e | 2 | public Component getComponent(String id) {
for (Component comp : components) {
if (comp.getId().equalsIgnoreCase(id))
return comp;
}
return null;
} |
22a86921-3cd1-4d83-a51d-a0794b7faf2e | 0 | public Help(MenuItem aboutMenuItem, MenuItem helpMenuItem) {
this.aboutMenuItem = aboutMenuItem;
this.helpMenuItem = helpMenuItem;
setSize(500,500);
setLocation(200,200);
textArea = new TextArea("", 100 , 100 , TextArea.SCROLLBARS_VERTICAL_ONLY);
textArea.setSize... |
e3b1c20a-abbf-45cf-8ecf-d30f0941d15c | 0 | public Period(int year, int month)
{
this.jaar = year;
this.maand = month;
this.locations = new ArrayList<DataPoint>();
} |
412dd550-888c-4ab6-af05-9e2e4023924d | 6 | public int func_48462_d(int par1, int par2, int par3)
{
return par1 >= -30000000 && par3 >= -30000000 && par1 < 30000000 && par3 < 30000000 ? (par2 < 0 ? 0 : (par2 >= 256 ? 0 : this.getChunkFromChunkCoords(par1 >> 4, par3 >> 4).getBlockLightOpacity(par1 & 15, par2, par3 & 15))) : 0;
} |
1e19f7c2-0d3e-4f60-9bc1-600d6d869d63 | 3 | public String jsonparse(String file, String name) {
JSONParser parser = new JSONParser();
try {
Object obj = parser.parse(new FileReader(file));
JSONObject jsonObject = (JSONObject) obj;
String gap = (String) jsonObject.get(name);
return gap;
} cat... |
b358a96a-b377-4db2-a165-4398eccb2c37 | 5 | public boolean onCommand(CommandSender sender, Command command,
String label, String[] args) {
if (!plugin.hasPerm(sender, "worldlist", true)) {
sender.sendMessage(ChatColor.YELLOW
+ "You do not have permission to use /" + label);
return true;
}
sender.sendMessage(ChatColor.YELLOW + "Worlds running... |
2f21fc2d-3fba-4d2e-9640-837af6caf358 | 9 | public int compare(Point a, Point b) {
if (priorityX) {
if (a.x < b.x) {
return -1;
} else if (a.x > b.x) {
return 1;
} else {
if (a.y < b.y) {
return -1;
} else if (a.y > b.y) {
return 1;
} else {
return 0;
}
}
} else {
if (a.y < b.y) {
return -1;
} else... |
254705c6-1603-4234-be4e-20bbde62ac93 | 7 | @Override
public void affectPhyStats(Physical affected, PhyStats affectableStats)
{
super.affectPhyStats(affected,affectableStats);
// when this spell is on a MOBs Affected list,
// it should consistantly put the mob into
// a sleeping state, so that nothing they do
// can get them out of it.
if((affected... |
4a039b8e-6e0c-42b4-93c1-b096de68c1eb | 0 | public void setNom(String nom) {
this.nom = nom;
} |
36e6b72f-4fec-4123-8d27-526bc6e6b555 | 5 | public void updateItem(PosListaPrecio itemOracle,
int idPos){
// PREGUNTO SI EL ID DEL ITEM VIENE EN NULO
if (itemOracle.getPcaIdElemento() != null) {
//TRAIGO EL ITEM POS SEGUN EL PCIDELEMENTO DE ORACLE
PhpposItemsEntity itemPos = getItemPos(itemOracle.getPcaIdElemen... |
127b7131-f99e-44f3-92de-f3a0c91a0cae | 4 | private Node insert(K key, E value, Node node) {
if (node == null) {
return new Node(key, value, 1);
}
int compareResult = node.key.compareTo(key);
if (compareResult == 0) {
node.value = value;
} else if (compareResult > 0) {//new key is less than in curre... |
c69bfe69-27b4-435c-a6a9-bb97636c3472 | 3 | @JavaScriptMethod
public void startAlarm() {
if (isDemoModeEnabled()) {
CiLightGlobalConfiguration config = CiLightGlobalConfiguration.get();
List<Endpoint> endpoints = config.getEndpoints();
for (Endpoint endpoint : endpoints) {
try {
... |
3b5d1802-eb9c-4e67-94bd-61f4e63f7d11 | 5 | public void update(Observable o, Object arg)
{
if (cellModel.getExploded()) { //means we draw an exploded mine, should only be true once per game
representation = 'X';
}
else {
if (!cellModel.getRevealed()) {
if (cellModel.getFlagged()) {
representation = 'F'; //draw a flagged cell (note tha... |
b6509d30-b325-41e0-8d11-8f4a17100418 | 8 | @Override
protected void readChild(XMLStreamReader in) throws XMLStreamException {
String childName = in.getLocalName();
if (Event.getXMLElementTagName().equals(childName)) {
Event event = new Event(null, getSpecification());
event.readFromXML(in);
events.add(even... |
59754e9a-a3a7-4163-a734-f9e6f015a4b4 | 0 | public void setEnabled(Component component, boolean enabled) {
tabbed.setEnabledAt(tabbed.indexOfComponent(component), enabled);
distributeChangeEvent();
} |
d93432c1-a2c3-4e3c-873e-4b20e0590621 | 1 | public Subcommand checkCommand(String name) throws CommandException {
Subcommand cmd = cmdMap.get(name);
if (cmd == null) {
throw new CommandException("Command \"" + name + "\" not found");
}
return cmd;
} |
269ae2b1-a4c2-4b45-9179-6b404f3466bf | 9 | private static void loadServerInfo(Element element) throws ESBBaseCheckedException {
String serverName;
String serverType;
String nodeName;
String memo;
// 启用CPU测量和线程争用监视
ManagementFactory.getThreadMXBean().setThreadCpuTimeEnabled(true);
ManagementFactory.getThre... |
c2aeab02-a75c-43b0-828d-fa653299c960 | 6 | public static boolean dbConnect(String confName){
try{
Map<String,String> confMap = config.get(confName);
if (confMap != null){
if (confMap.get("type").equals("db")){
DataBase dataBase = null;
switch (confMap.get("base_type")){
case "mysql": dataBase = new MySQLImpl();
break;
c... |
3e5258e3-163b-416b-8bae-10e41884283a | 2 | public boolean validateLoggedIn() {
boolean result = false;
if(this.name != null && this.password != null) {
result = true;
}
return result;
} |
51e211cc-0ee2-4033-83d9-c8dd6d75328b | 4 | public static void main(String[] argv) {
// Fonction main contenant des jeux de tests pour les méthodes à compléter.
// En commentaire : la trace d'exécution attendue.
MyPanel panel = new MyPanel();
int x = 50;
int y = 50;
int size = 40;
int colorIndexFrom0To5 = 4;
int posX = 1;
int posY = 1;
B... |
162cdfb7-3abf-4054-8711-496a561beeb6 | 1 | public static void getDiff(File newFile, File printFile, File replaceFile) {
HashMap<String, Integer> printed;
HashMap<String, Integer> potentialPrints = new HashMap<String, Integer>();
HashMap<String, Integer> latestEdition = new HashMap<String, Integer>();
try {
printed = addFiles(printedFile);
potent... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.