method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
39ff35f8-d851-491c-838f-a4265938df3b | 3 | public static void validateUsername(String username) throws ProtocolException {
if(username.length() < 3){
throw new ProtocolException("Username too short: needs to be 3 characters or longer.");
}
if(username.length() > 16){
throw new ProtocolException("Username too long: needs to be 16 characters or less.... |
310e126d-ff89-4a1c-9434-230a7c72483e | 6 | static boolean haveImage (int w, int h, Color c, int ox, int oy, int d)
{ if (StaticImage==null) return false;
return (w==W && h==H && ox==Ox && oy==Oy && D==d && C.getRGB()==c.getRGB());
} |
0fd10c30-7fde-4d41-bb4e-6b0acb5f799d | 8 | public static Cons yieldInCursorClauses(Cons intree, boolean dontoptimizeP, Object [] MV_returnarray) {
{ Stella_Object vartree = intree.rest.value;
Symbol keyvar = null;
Symbol valuevar = null;
Surrogate collectionbasetype = null;
{ Stella_Object collectiontree = null;
StandardObje... |
02004434-0eae-4db3-bb5b-496690f23daa | 7 | public boolean refreshStatus() {
// - Get the status
Icon icon;
String info = null;
switch (lfs.getStatus()) {
case LessFileStatus.UP_TO_DATE:
icon = OK;
break;
case LessFileStatus.ERROR:
icon = ERROR;
break;
case LessFileStatus.UNKNOWN:
case LessFileStatus.PROCESSING:
icon = WAIT;
bre... |
6663a8b5-daea-4e64-8d84-ed1762d2db7d | 9 | @Override
public int allocateClusters(int tailCluster, int count) throws IOException {
int headCluster = -1;
int tailOffset = tailCluster;
while (count > 0 && freeListHead >= 0) {
int fatEntry = fs.getFatEntry(freeListHead);
if ((fatEntry & CLUSTER_STATUS) == CLUSTER_... |
21094195-c982-447e-ab55-0e8e6f24b219 | 7 | @Override
public void run(){
Scanner sc = new Scanner(System.in);
ArrayList<MenuItem> menu = menuManager.getMenu();
while(true){
System.out.print("1. Add New Alacarte to Menu \n"
+ "2. Add New Set to Menu\n3. Delete MenuItem from the Menu\n4. Update the Alacar... |
d6a14489-e196-49cc-bff5-d0a67087feeb | 9 | private String createAuction() {
if (user.isOnline()) {
int duration = 0;
String describtion = "";
try {
duration = Integer.parseInt(stringParts[1]);
if (duration <= 0) {
return "Error: The duration has to be > 0!";
}
for (int i = 2; i < stringParts.length; i++) {
desc... |
9caa1086-66fb-4f24-b1f6-7e53aa71f9d8 | 9 | @Override
public boolean execute(final MOB mob, List<String> commands, int metaFlags)
throws java.io.IOException
{
if(mob.soulMate()!=null)
dispossess(mob,CMParms.combine(commands).endsWith("!"));
else
if(!mob.isMonster())
{
final Session session=mob.session();
if(session!=null)
{
if((sessio... |
2c7610a0-d3dc-47d0-8e64-f534bbc6b0fd | 5 | public List<?>[] getStates()
{
ArrayList<Integer> ids = new ArrayList<Integer>();
ArrayList<TaggedStorageChunk> chunks = new ArrayList<TaggedStorageChunk>();
try
{
DataInputStream in = new DataInputStream(new ByteArrayInputStream(data));
int size = in.readInt(... |
cf116f8b-cfdc-4186-a571-d0f10ec37dab | 6 | protected void processSingleClick(MouseEvent e) {
Node node = textArea.node;
JoeTree tree = node.getTree();
if (e.isShiftDown()) {
tree.selectRangeFromMostRecentNodeTouched(node);
} else if (e.isControlDown()) {
if (node.isSelected() && (tree.getSelectedNodes().size() != 1)) {
tree.removeNodeFromSe... |
0151644f-6b57-447f-a155-bfe58bfb45dc | 8 | public static String formatName(String name) {
if (name.length() > 0) {
char characters[] = name.toCharArray();
for (int c = 0; c < characters.length; c++)
if (characters[c] == '_') {
characters[c] = ' ';
if (c + 1 < characters.length && characters[c + 1] >= 'a'
&& characters[c + 1] <= 'z')... |
5b9c84de-e8d7-41c6-becd-caf771823636 | 3 | private void spellCheck() {
String word = this.currentWord.toString();
if (!word.equals("")
&& SpellChecker.getInstance().isMisspelled(word)) {
if (this.spllingErrorHandler != null) {
this.spllingErrorHandler
.handleSpellingError(this.currentWord.toString(),
this.uiGlyphs
.toAr... |
2808d1cf-a05a-45d7-a457-6ea422de86c5 | 3 | public Tree orExpressionPro(){
Tree firstConditionalExpression = null, secondConditionalExpression = null;
Symbol operator = null;
if((firstConditionalExpression = andExpressionPro()) != null){
if((operator = accept(Symbol.Id.PUNCTUATORS,"\\|\\|")) != null){
if((secondConditionalExpression = orExpressio... |
82934b91-2443-4d62-8a55-a778b123e36a | 1 | public void addQLDropTargets(DropTargetFactory dtf){
for(JButton btn : quick_btns){
btn.setDropTarget(dtf.makeDropTarget());
}
} |
b5aa6fa7-6e89-442a-825f-af4b057428b0 | 6 | @SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void collecter(APreprocessingEngine aPPEngine) {
try {
File[] lesFichiers = repertoireInput.listFiles();
if (lesFichiers != null) {
for (int i = 0; i < lesFichiers.length; i++) {
String leContenu = new String();
BufferedReader reade... |
f1e6ecf3-4181-4b50-99a3-d45261ded927 | 0 | public void setSpeech(String speech) {
this.speech = speech;
} |
5952c68b-9a18-42c7-a251-b406312095fd | 3 | public static void readCSVFile(String path, String csvSplitBy) {
BufferedReader read;
String line;
try {
read = new BufferedReader(new FileReader(path));
while ((line = read.readLine()) != null) {
String[] data = line.split(csvSplitBy);
Que... |
df6d3d18-b8cc-47de-9550-1392dfe15acb | 2 | public static void main(String[] args) throws JSONException {
/* Thread t = new Thread();
t.start();*/
for(int i=1;i<10000;){
JSONArray data = getData(i);
String res = data.getString(0);
JSONObject o = new JSONObject(res);
//System.out.println(o);
JSONObject o1 = new JSONObjec... |
447db2c7-ce6f-4de8-8c69-afd925a1d333 | 1 | public void reapply(){
if( factory != null ){
factory.setDiagram( view.getDiagram() );
}
} |
2374bf4d-739b-4c4c-a63f-4418f2a02a35 | 4 | @Override
public double execute(Date start, Date end) {
int duration = TimeCalculator.duration(start, end);
duration = duration % this.minuteUnit > 0 ? (duration / this.minuteUnit + 1)
: duration / this.minuteUnit;
double price = 0;
if (duration == 1) {
price = this.firstMinutePrice;
} else if (durati... |
b861b35d-9b22-4803-9c8d-aab50f109183 | 7 | public static void main(String[] args) {
int[][] adjacencyMatrix;
Scanner in = new Scanner(System.in);
// get first line and get the number of cases to test.
int caseCount = Integer.parseInt(in.nextLine());
int loopCount = 0;
while (caseCount - loopCount > 0) {
String line = in.nextLine(... |
0f328880-145f-4e93-b4d8-16b223fea859 | 4 | public double value()
{
ArrayList<Object> argsValues = new ArrayList<Object>();
for (Block arg: args)
{
argsValues.add(arg.value());
}
try
{
return (Double) method.invoke(null, argsValues.toArray());
} catch (IllegalArgumentException e) {
} catch (Illegal... |
92daa904-c761-4a8c-93ba-8a8582fa0dbb | 5 | public ResultSet queryResult(String query) {
final Connection connection = getConnection();
try {
if (connection == null) {
Utilities.outputError("Could not connect to database '" + m_databaseName + "'");
return null;
}
if (m_statement != null) {
m_statement.close();
m_statement ... |
291c47e5-ca30-4706-b37f-87a95c7e3962 | 3 | private void doEditUser(HttpServletRequest request, HttpServletResponse response,boolean isEditUser) throws ServletException, IOException {
String userId = StringUtil.toString(request.getParameter("userId"));
if(!StringUtil.isEmpty(userId)) {
User user = null;
try... |
4c82d3b2-5088-41a8-ada9-0232ac1963db | 6 | private Image getImage(String filename) {
// to read from file
ImageIcon icon = new ImageIcon(filename);
// try to read from URL
if ((icon == null) || (icon.getImageLoadStatus() != MediaTracker.COMPLETE)) {
try {
URL url = new URL(filename);
... |
730b0802-944d-4bbc-a1aa-2f01f998fca4 | 7 | public void saveModel() {
try {
if (m_fileChooser == null) {
// i.e. after de-serialization
m_fileChooser =
new JFileChooser(new File(System.getProperty("user.dir")));
ExtensionFileFilter ef = new ExtensionFileFilter("model", "Serialized weka clusterer");
m_fileChooser... |
12a12734-8aac-4e72-981b-2dfa26a2eeb0 | 4 | @Override
public void run() {
try {
//1. creating a server socket
providerSocket = new ServerSocket(2004, 10);
//2. Wait for connection
System.out.println("Waiting for connection");
connection = providerSocket.accept();
System.out.pri... |
7509dd03-71a2-4fa4-9f9e-9d5de6d0daba | 8 | public Tuple<GameCharacter, Item> battleMenu(GameCharacter hero) {
System.out.println("\n" + hero.getName() + "'s turn!");
System.out.println("1.) Attack somebody.");
System.out.println("2.) Use an item.");
System.out.println("3.) View your party.");
System.out.println("4.) View enemy party.");
int choic... |
258e3e08-2d19-4b1c-93b8-3c4d37d5b292 | 1 | public boolean needShuffle() {
if (count == 50)
return true;
else
return false;
} |
42c5e25e-dc02-441e-93ca-5ab7fd9fbc21 | 2 | @Override
public TLValue evaluate() {
TLValue a = lhs.evaluate();
TLValue b = rhs.evaluate();
// number + number
if(a.isNumber() && b.isNumber()) {
return new TLValue(a.asDouble() / b.asDouble());
}
throw new RuntimeException("illegal expression: " + this);
} |
648587b8-2e1a-4f20-aa08-69bb6fd446d6 | 8 | public static void deleteFile(File file)
{
if (file.isDirectory())
{
File[] children = file.listFiles();
if (children != null)
{
for (File child : children)
deleteFile(child);
}
children = file.listFiles();
if (children == nu... |
24c5b6f3-d15c-49eb-9725-2c286f041fa7 | 2 | private void initialize() {
frmShowProduct = new JFrame();
textField_nr = new JTextField();
textArea_info = new JTextArea();
textField_nr.setHorizontalAlignment(SwingConstants.CENTER);
JButton btnShow = new JButton("show");
frmShowProduct.setTitle("Show Product");
frmShowProduct.setBounds(100, 100, 450, ... |
5d8285d3-6870-493f-8baa-b1a1ff300657 | 9 | @Override
public HashMap<Integer, ArrayList<SamplePoint>> SpatialTemporalWindowQuery(long midTime, long tRadius, double longitude, double latitude, double sRadius) {
// TODO Auto-generated method stub
HashMap<Integer, ArrayList<SamplePoint>> result = new HashMap<>();
int segment... |
228925ae-c611-479c-bada-6cb404034432 | 4 | protected static void stopChatServer(Thread chatServerThread) {
while (chatServerThread.isAlive()) {
chatServerThread.interrupt();
log.info("INTERRUPT chat Server Thread");
try {
// this dummyClient is needed when chatServerThread
// is blocked in serverSocket.accept();
Socket dummyClient = new S... |
085fc62e-cb99-4ae9-9f49-f7d9f0f5aa46 | 6 | public Node checkISBNDel(Node temproot,int isbn){ //find the node(book object with ISBN
boolean b=false;
if(temproot!=null){
if(temproot.leftChld!=null || temproot.rightChld!=null)
parent=temproot; //keep the track of parent of current node
checkISBNDel(temproot.leftChld,isbn); // call recursively... |
f0314b36-27c9-4581-ac0d-55ec2b0e59c2 | 6 | public void deleteSelectedElements() {
for (Element element : selectedElements) {
// Place
if (element instanceof Place) {
((PetriNet) getGraph()).deletePlace(((Place) element).getName());
}
// Transition
if ... |
f8a7b722-038e-481d-840d-d4a21aea33cc | 0 | @GET
@Path("events/{id}")
@Produces({MediaType.APPLICATION_JSON })
public EventItf getEvent(@PathParam("id")int idEvent){
System.out.println("Return the event selected by the id");
return JpaTest.eventService.getEvent(idEvent);
} |
c0eb042e-9dbb-47a4-8d91-f1bbdb256864 | 8 | @Override
public ArrayList<Move> generateMovesForThisPiece(Chessboard chessboard) {
int toX = -1, toY = -1;
final ArrayList<Move> moves = new ArrayList<Move>();
final String positionPiece = chessboard.getPositionPiece(this);
final int getX = Helper.getXfromString(positionPiece);
final int getY = Helper.get... |
dd195fc1-9453-41e5-b643-351ed054cc8a | 6 | public Cons vizGetBinaryRelationsOf(LogicObject concept) {
{ VizInfo self = this;
{ MemoizationTable memoTable000 = null;
Cons memoizedEntry000 = null;
Stella_Object memoizedValue000 = null;
if (Stella.$MEMOIZATION_ENABLEDp$) {
memoTable000 = ((MemoizationTable)(OntosaurusU... |
b988f6bf-720e-4673-aa3b-2d48a13f83fe | 7 | public static boolean closedTermP(Stella_Object self) {
{ MemoizationTable memoTable000 = null;
Cons memoizedEntry000 = null;
Stella_Object memoizedValue000 = null;
if (Stella.$MEMOIZATION_ENABLEDp$) {
memoTable000 = ((MemoizationTable)(Logic.SGT_LOGIC_F_CLOSED_TERMp_MEMO_TABLE_000.surrog... |
1093b5f6-3b9f-46be-8621-8dc33735e3f5 | 7 | public int[] checkPrime3(BigInteger n) {
char[] digits = n.toString().toCharArray();
int count0 = 0, count1 = 0, count2 = 0;
int[] c0 = new int[3], c1 = new int[3], c2 = new int[3];
int[] c5 = new int[1];
for (int i = 0; i < digits.length; i++) {
char c = digits[i];
... |
d705ed70-1a8e-482d-8369-9bba86700cf6 | 3 | public RSInterface[] getSelectedChildren() {
RSInterface parent = getInterface();
RSInterface[] children = new RSInterface[parent.children.size()];
int count = 0;
for (int index = 0; index < children.length; index++) {
RSInterface child = RSInterface.getInterface(parent.children.get(index));
int childX = ... |
d4accb66-a47b-47cd-9c5a-89783d9431bb | 8 | public static void main(String[] args) throws Exception {
String mfa = ConfigReader.getCHSDir() + File.separator +
"BroadTrees" + File.separator + "all76.mfa";
String classify = ConfigReader.getCHSDir() + File.separator +
"rbh" + File.separator + "GenomeToClass.txt";
String output = ConfigReader.getCHSD... |
79b1cc09-33ae-4d7a-a3ea-3fcaa41d3d1a | 8 | private static void bigClosestDepotRouteWithUniformCut(Individual individual)
{
ProblemInstance problemInstance = Individual.problemInstance;
//Assign customer to route
boolean[] clientMap = new boolean[problemInstance.customerCount];
int assigned=0;
individual.bigRoutes = new ArrayList<ArrayList<ArrayLis... |
ec95ef12-e269-4984-856e-5905c084db94 | 4 | @Override
public void mouseDragged(MouseEvent e)
{
if (!e.isConsumed() && start != null)
{
int dx = e.getX() - start.x;
int dy = e.getY() - start.y;
Rectangle r = graphComponent.getViewport().getViewRect();
int right = r.x + ((dx > 0) ? 0 : r.width) - dx;
int bottom = r.y + ((dy > 0) ? 0 : r.heig... |
3b4758ee-071d-4f9b-8867-6735d367e0a5 | 8 | static String weekdag(int dag, int maand, int jaar) {
String dagVanDeWeek = "";
int getallenArray[] = {0,3,2,5,0,3,5,1,4,6,2,4};
int uitkomst;
if(maand < 3)
jaar--;
uitkomst = (jaar + jaar/4 - jaar/100 + jaar/400 +
getallenArray[maand - 1] + dag) % 7;
if(uitkomst == 0)
dagVanDeWeek = "zondag";
... |
d64c9fb3-6c53-42d3-aafd-6e4c4bcdf101 | 9 | public List<EmprestimoEstoque> pesquisarPorTodosOsDadosNaoNulos(EmprestimoEstoque emprestimoEstoque) {
List<EmprestimoEstoque> emprestimosEstoques = new LinkedList<>();
Connection connection = conexao.getConnection();
try {
String valorDoComandoUm = comandos.get("pesquisarPorTodosOsD... |
d4bded47-b676-418c-a305-04e9a4fb56ca | 9 | private static void loadChunkData(CompoundTag levelTag, short[][] sectionBlockIds, byte[][] sectionBlockData, boolean[] sectionsUsed, byte[] biomeIds) {
for (int i = 0; i < MAX_CHUNK_SECTIONS; i++) {
sectionsUsed[i] = false;
}
Tag biomesTag = levelTag.getValue().get("Biomes");
... |
c2147113-e897-46a2-bbfa-07ba2b1613d3 | 8 | @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(target==mob)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return f... |
b93a716e-6b4a-4648-86a3-6c8fbf70512a | 3 | /* */ public void animate(Graphics g) {
/* 408 */ for (int i = 0; i < effects.size(); i++) {
/* 409 */ Effect e = (Effect)effects.get(i);
/* 410 */ e.update(17);
/* 411 */ if ((e.isElapsed()) || (!e.alive)) {
/* 412 */ effects.remove(i);
/* 413 */ e = null;
/* */ } ... |
687fb2ba-0744-4c61-a053-40d5d05c1624 | 6 | @EventHandler(priority=EventPriority.HIGHEST)
public void onBlockPlace(BlockPlaceEvent event)
{
int iloscGildii = Bufor.iloscGildii;
if (iloscGildii != 0) {
for (int i = 0; i < iloscGildii;i++)
{
if (!(event.isCancelled())) {
String aktualnaGildia = Bufor.listaGildii.get(i);
... |
b667607c-e54d-4faf-a5e6-6d2e144b6a93 | 7 | public static void main(String[] args) {
int solutionsCount = 0;
int maxSolutionsCount = -1;
int optimalPerimeter = -1;
for (int perimeter = 3; perimeter <= PERIMETER_MAX; ++perimeter) {
for (int i = 1; i < perimeter - 1; ++i) {
for (int j = i; j <= perimeter - i; ++j) {
for (int k = j; k <= perime... |
c420c938-2c0f-4f44-b300-2c9c6fa6377d | 4 | public void downloadUpdate() {
button.setEnabled(false);
downloader = new Thread(new Runnable() {
@Override
public void run() {
double size = updater.getFileSize("http://nazatar.bplaced.net/Mod/Unreal.jar/Unreal.jar");
Update.label_6.setText("" + s... |
d5c77c1b-d052-4eff-858d-632e656d0e48 | 2 | public DisplayBoard clone()
{
DisplayBoard cloned = new DisplayBoard(width, height);
for(int x = 0; x < width; x++)
{
for(int y=0; y < height; y++)
{
cloned.grid[x][y] = grid [x][y];
cloned.colorGrid[x][y] = colorGrid[... |
8d0903e2-5c35-4ce6-b3f3-cade88eca823 | 3 | void printHeader(String header) {
w.println("@T, \"" + header + "\"");
w.println(" " + DataIO.KEY_CREATED_AT + ", \"" + new Date() + "\"");
w.println(" " + DataIO.DATE_FORMAT + ", " + dfmt.toPattern());
String dig = System.getProperty("oms3.digest");
if (dig != null) {
... |
b2eb1d14-47c9-4e8e-a4e9-9ad125aea4e4 | 0 | public Connection getConnection(){
return connection;
} |
a272d638-918c-4de9-ba75-9842efdd4f37 | 9 | public static void main(String[] args) {
int N = Integer.parseInt(args[0]);
// add elements 1, ..., N
StdOut.println(N + " random integers between 0 and 99");
DoublyLinkedList<Integer> list = new DoublyLinkedList<Integer>();
for (int i = 0; i < N; i++)
list.add((int... |
919aeb76-44e0-4411-9f7b-9bd4446284f8 | 1 | static Set<Point> rangePonints(Point from,int k,Map<String,Point> pointMap){
Set<Point> result=new HashSet<>();
for(int i=0;i<=k;++i){
collectPoint(pointMap,result,from,i,0);
collectPoint(pointMap,result,from,-i,0);
collectPoint(pointMap,result,from,0,i);
... |
36d12596-be66-495c-870e-0ab9f42b66d8 | 2 | public String[] getEquiv(String man)
{
ArrayList<String> matches = new ArrayList<String>();
for(String aMan : manus)
{
if(man.equals(aMan))
{
int i = manus.indexOf(aMan);
matches.add(numbers.get(i));
}
}
return matches.toArray(new String[0]);
} |
f8598c24-0539-4235-a784-dd2bf3373278 | 4 | public double getPriceForQuantity( int quantity ) {
double price = 0;
for( Object object : orderList.toArray() ) {
Order order = (Order)object;
if( quantity > 0 ) {
if(quantity >= order.getQuantity()) {
price += order.getPrice();
quantity -= order.getQuantity();
} else if(quantity < orde... |
c17f9a6c-a8b6-4089-9711-217da6fe8aa2 | 8 | private static String sortCharacters(String string) {
if (string == null)
return null;
char[] array = string.toUpperCase().toCharArray();
char leftChar = 'A';
char rightChar = 'Z';
int index = 0;
int left = 0;
int right = array.length - 1;
// 13 passes at most
while (left < right) {
whi... |
b40fbb33-5a1c-4aba-8739-f7d68e63d2b6 | 3 | @Override
protected void read(InputBuffer b) throws IOException, ParsingException {
VariableLengthIntegerMessage vLength = getMessageFactory().parseVariableLengthIntegerMessage(b);
b = b.getSubBuffer(vLength.length());
long length = vLength.getLong();
if (length < 0 || length > Options.getInstance().getInt("p... |
8288dd85-5c8e-461e-8d5e-a8b53b787286 | 8 | void parseDAS(DAS das) throws IOException {
Enumeration tableNames = das.getNames();
while (tableNames.hasMoreElements()) {
String tableName = (String) tableNames.nextElement();
AttributeTable attTable = das.getAttributeTableN(tableName);
if (tableName.equals("NC_GLOBAL") || tableName.equals(... |
d8f0e52c-7a41-4fc2-a6f0-1264dcec1e50 | 6 | public void body()
{
// wait for a little while for about 3 seconds.
// This to give a time for GridResource entities to register their
// services to GIS (GridInformationService) entity.
super.gridSimHold(3.0);
LinkedList resList = super.getGridResourceList();
// in... |
219ac1eb-cd3c-4200-8f14-3660e45f90f6 | 8 | public String cleanText () {
// Time-saving check.
if (source.indexOf ("<lj") < 0) {
return source;
}
sourceLength = source.length ();
// Create a mirror string which is all lower case, to facilitate tag matching
lcSource = source.toLowerCase... |
d7b1a037-402f-441e-a44c-c8d01465770f | 4 | public String searchPostDiscussion(String url){
String discussionUrl = "";
if(url.contains(PaginationParameters.getPostsUrlPattern())){
String urlWithoutPattern = url.substring(0, url.indexOf(PaginationParameters.getPostsUrlPattern()));
try {
@SuppressWarnings("resource")
final Scanner scanner = new ... |
673ec9f4-2ad7-43ce-aa21-f693fe55996a | 1 | @PUT
@Path("/v2.0/subnets/{subnetId}")
@Produces(MediaType.APPLICATION_JSON)
public Response updateSubnet(@PathParam("subnetId") String subnetId, final String request) throws MalformedURLException, IOException{
//Convert input object NetworkData into a String like a Json text
Object sub;
sub = JsonUtility.from... |
5f835c21-74bb-4c0e-89a9-85a70efe128e | 5 | public IMessage decrypter(IMessage crypte, String key) {
/*
* Cette mthode lit d'abord la cl l'aide de remplirArray, puis
* dcode les caractres un un via des appels repetes encoderChar
*/
long d=new Date().getTime();
this.remplirArray(key);
char[] c=new char[crypte.taille()];
int v=-1;
int y=-1;... |
195d30ad-84ff-4781-b378-f5c414823540 | 3 | public void setWindowOpaque(Window window, boolean isOpaque) {
try {
// prevent setting if not supported
if(!isTranslucencyCapable(window.getGraphicsConfiguration()) ||
!isTranslucencySupported(Translucency.PERPIXEL_TRANSLUCENT, window.getGraphicsConfiguration().getDevice())) {
return;
}
setWindo... |
7ffcbe7f-e95f-4290-930e-95d4705296e7 | 3 | @Override
void removeChild(@SuppressWarnings("unused") Node child)
{
// Remove child
if(this._caso_ == child)
{
this._caso_ = null;
return;
}
if(this._valor_ == child)
{
this._valor_ = null;
return;
}
... |
61eee193-3a5a-494c-9afd-8d9e3a70bf5d | 1 | public boolean beq(String instruction) {
String[] instArray = instruction.split(" ");
Register source1 = getRegister(1, instArray);
Register source2 = getRegister(2, instArray);
int imm = Integer.parseInt(instArray[3]);
if (source1.getValue().equals(source2.getValue())) {
int pcValue = binaryToDecimal(regi... |
e80734f6-e6f2-4789-8597-0bf8b5af7239 | 5 | public boolean WC() {
if(WCTimer <= 0) {
if(TreeHP == 0) {
AddGlobalObj(TreeX, TreeY, 1341, 0, 10);
sendMessage("This tree has run out of logs");
ResetWC();
return false;
}
else {
if(!hasAxe()) {
sendMessage("You need an axe to chop down this tree.");
ResetWC();
}
else if(hasAxe()) {
addSkillXP(WCxp, 8);
if(!addItem(l... |
baec88a8-8269-4d20-a61a-4bc594dc7a47 | 3 | public synchronized Class<?> compileSource(String name, String code) throws Exception {
Class<?> c = cache.get(name);
if (c == null) {
c = compileSource0(name, code);
cache.put(name, c);
}
return c;
} |
68e7ac05-91d9-4604-b4a4-3d7f4dd6cbee | 6 | private boolean jj_3R_36()
{
Token xsp;
xsp = jj_scanpos;
if (jj_scan_token(21)) {
jj_scanpos = xsp;
if (jj_scan_token(22)) {
jj_scanpos = xsp;
if (jj_scan_token(23)) {
jj_scanpos = xsp;
if (jj_scan_token(24)) {
jj_scanpos = xsp;
if (jj_scan_token(38)) {
jj_scanpos = xsp... |
87539045-8edb-4a76-8cca-0ae9eb438b82 | 2 | public void setWeightsAsResponses(){
this.weightsEntered = false;
this.weightOption = 1;
if(this.nResponses>0){
this.weights = new double[this.nResponses];
for(int i=0; i<this.nResponses; i++){
this.weights[i] = Math.abs(this.responses[i]);
... |
1c512bfc-cb51-454b-a528-b64094096803 | 6 | private static double getSigma(int threshold, double[] probabilities) {
double w1 = 0;
double w2 = 0;
for (int i = 0; i < probabilities.length; i++) {
if (i <= threshold) {
w1 += probabilities[i];
} else {
w2 += probabilities[i];
}
}
if (w1 == 0 || w2 == 0) {
return 0;
}
double mu1 = 0... |
5317565b-fca8-4a38-8704-e3e4868d51eb | 1 | public boolean areWeSame(MyLogger myLogger){
boolean bothAreSame = false;
if(this == myLogger)
bothAreSame = true;
return bothAreSame;
} |
64f3f0a2-5e2a-4d66-9fc8-e465715bfc63 | 0 | private void remCallObj(Long key) {
sync.remove(key);
} |
1eedcf72-7e0b-4b0c-8b02-5eb338a3beaa | 2 | public boolean HasPermission(Player player, String perm) {
if (player instanceof Player) {
// Real player
if (player.hasPermission(perm)) {
return true;
}
} else {
// Console has permissions for everything
return true;
}
return false;
} |
8f10747f-680b-4f32-9eaf-e4084aeff220 | 5 | final int[][] method1036(int i, int j) {
if (i > -94) {
anInt1812 = -1;
}
if (~anInt1808 == ~anInt1810) {
aBoolean1822 = aClass142_Sub29Array1809[j] == null;
aClass142_Sub29Array1809[j] = StrongReferenceHolder.aClass142_Sub29_5003;
return ... |
ea3e9507-9f75-4ac9-b9a3-9da9787abb97 | 8 | @SuppressWarnings("static-access")
public void scanForIPs() {
Thread t = new Thread() {
public void run() {
status.setText("Scanning network for reachable servers");
repaint();
String IPV4 = "";
try {
String currentIP = getLocalAddress().toString().replaceFirst("/", "");
String[] parts =... |
22debfc8-8ec5-4b5d-a9ff-d15b91d8e9aa | 2 | public ByteVector putByteArray(final byte[] b, final int off, final int len) {
if (length + len > data.length) {
enlarge(len);
}
if (b != null) {
System.arraycopy(b, off, data, length, len);
}
length += len;
return this;
} |
7968e9f0-1905-4b5a-83d5-91b3ee3efeca | 7 | public static final AttackInfo parseDmgM(final LittleEndianAccessor lea) {
final AttackInfo ret = new AttackInfo();
lea.skip(1);
ret.tbyte = lea.readByte();
ret.targets = (byte) ((ret.tbyte >>> 4) & 0xF);
ret.hits = (byte) (ret.tbyte & 0xF);
ret.skill = lea.readInt();
switch (ret.skill) {
case 5101004: //... |
137f6c44-4752-49f7-946d-6d5699cb9cd1 | 8 | public boolean canBearOff(Color player){
int count = 0;
if (player == this.getPlayer2()){
for (int i = 1; i < 7; i++){
if (this.getPoint(i).size() > 0) {
count += (BackgammonModel.getColor(this.getPoint(i)) == player) ? this.getPoint(i).size() : 0;
}
}
count += this.getPlayer2Home().size();
... |
93f53047-400f-429a-9c93-1e07b5ca8325 | 9 | private int minMove(Board prev, int depth, int alpha, int beta)
{
moves++;
if(depth >= maxDepth) return prev.getScore(); // exceeded maximum depth
int minScore = MAX_SCORE;
Board b = new Board(prev);
b.turn(); // min player's turn
for(int j = 0; j < size; j++)
{
for(int i = 0; i < siz... |
a04e5122-a206-4c61-afc4-143015938d54 | 2 | public int inLocalDB(String file_path) {
int index = -1;
DBLikeFileObject element = null;
Iterator<DBLikeFileObject> itr = localDB.iterator();
for (int i = 0; i < localDB.size(); i++) {
element = itr.next();
if (element.getLocalFilePath().equals(file_path)) {
index = i;
}
}
return index;
} |
4196df29-0edc-43b9-a161-7dcbd80a2bf9 | 6 | private boolean processCommand(Command command)
{
boolean wantToQuit = false;
if(command.isUnknown()) {
System.out.println("I don't know what you mean...");
return false;
}
String commandWord = command.getCommandWord();
if(commandWord.equals... |
9f9d8267-8ce4-4795-b3b1-4036471885e1 | 9 | public static String escapeHtmlString(String src) {
if (src == null) {
return src;
}
StringBuffer sb = new StringBuffer();
for (int i = 0; i < src.length(); i++) {
char ch = src.charAt(i);
switch (ch) {
case '&':
if (i + 1 <= src.length() && src.charAt(i + 1) == '#') {
sb.append('&');
}... |
0dd017da-3e73-4e73-8bbb-2157566021d8 | 3 | public static int findNumDays(String fileName)
{
int lineNumber = 0;
String line;
try {
BufferedReader br = new BufferedReader( new FileReader(fileName));
while( (line = br.readLine()) != null)
{
lineNumber++; ... |
78a9d188-4eae-4377-b88a-9290636b9d70 | 4 | public String GetItemName(int ItemID) {
for (int i = 0; i < server.itemHandler.MaxListedItems; i++) {
if (server.itemHandler.ItemList[i] != null) {
if (server.itemHandler.ItemList[i].itemId == ItemID) {
return server.itemHandler.ItemList[i].itemName;
}
if (ItemID == -1)... |
ac423591-00c5-4f96-a68e-21ba39672f27 | 2 | private List<Position> getEnclosedPositions(Position from, Position to, Direction dir) {
List<Position> enclosedPositions = new ArrayList<Position>();
Position newPos = from;
while (!newPos.equals(to)) {
enclosedPositions.add(newPos);
newPos = dir.newPosition(newPos);
if (!getGrid().validPosition(newPos)... |
eeae1304-d55f-41a4-8630-cb9c299717b8 | 6 | public void removeEdges(QueryVertex v1, QueryVertex v2) {
List<QueryEdge> adj1 = this.edges.get(v1);
for(Iterator<QueryEdge> it = adj1.iterator(); it.hasNext(); ) {
QueryEdge e = it.next();
if(e.getEndPoint().equals(v2))
it.remove();
}
if(adj1.size() == 0) {
this.edges.remove(v1);
}
List<Que... |
1a3b0aac-2d40-46d8-a056-2d38598c3e0f | 6 | public ProfileEditorDialog(LaunchFrame instance, final String editingName, boolean modal) {
super(instance, modal);
setupGui();
getRootPane().setDefaultButton(update);
username.setText(UserManager.getUsername(editingName));
name.setText(editingName);
if (UserManager.g... |
5f9dc267-ea58-4137-b0c7-16371d6e61f1 | 2 | public void deposit(BigInteger amount) throws IllegalArgumentException {
if ( (amount == null) || (amount.compareTo(BigInteger.ZERO) <= 0) )
throw new IllegalArgumentException();
setBalance(this.getBalance().add(amount));
} |
692bbabf-15ab-455f-8c84-f2b363e7fb0b | 5 | public static int CMM2(int[] dimension, int[][] array, String[][] sequence, int start, int end){
if (start >= end) return 0;
int temp;
for(int i = start; i < end; i++){
if(array[start][i] == Integer.MAX_VALUE)
array[start][i] = CMM2(dimension, array, sequence, start, i);
if(array[i+1][end] == Integer.MA... |
51461344-d2fc-4360-a7be-5ebf237a6341 | 3 | private static void copyFile(File sourceFile, File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChannel();... |
8da6ef24-704e-4781-8481-e57ffd707bed | 3 | public DashboardPanel(MainFrame owner) {
User user = Service.getCurrentUser();
this.owner = owner;
this.repainter = Updater.getInstance();// new Updater(60000);
this.repainter.registerObserver(this);
this.setLayout(new BorderLayout());
pnlDashboardCenter = new JPanel();
pnlDashboardCenter.setLayout(new... |
02a7c545-aa67-4473-9d33-90ee69917499 | 7 | double evaluateInstanceLeaveOneOut(Instance instance, double [] instA)
throws Exception {
DecisionTableHashKey thekey;
double [] tempDist;
double [] normDist;
thekey = new DecisionTableHashKey(instA);
// if this one is not in the table
if ((tempDist = (double [])m_entries.get(thekey)) == nu... |
d0b628d1-3693-4adb-aa70-fd348a6db460 | 7 | public double opt(Function f, double eps)
{
eps *= Math.abs(a-b); // make accuracy relative
double x0 = Math.min(a,b);
head = new Node(null, x0, f.eval(x0));
x0 = Math.max(a,b);
Node nn = new Node(null, x0, f.eval(x0));
head.setNext(nn);
double xMax, yMax;
... |
6ecac0e1-9dea-47fc-88de-4fea10aec651 | 6 | public static long bruteforce() throws IOException{
System.out.println("Brute Force initiated.");
DataBuff Buff = new DataBuff(Main.DataFile);
ArrayList<String> Querry = new ArrayList<String>();
String stringLine = null;
double angle = Math.PI/2;
int indextwt = 0;
int indexque = 0;
String twt = null;... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.