method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e878415d-c50d-4bd8-99cc-a5b4ab3ed747 | 5 | public boolean goForward() {
if (!canGoForward())
return false;
switch (dir) {
case EAST:
position.x += 1;
break;
case NORTH:
position.y -= 1;
break;
case SOUTH:
position.y += 1;
break;
case WEST:
position.x -= 1;
break;
default:
return false;
}
return true;
} |
b5bccebd-432a-4f72-b79a-03cc69b29a54 | 4 | private void merge(int l, int q, int r) {
/**
* Das zu sortierende Array wird fortlaufend rekursiv in zwei Teile aufgeteilt.
* Die Teilstücke werden über ein Hilfsarray (arr) sortiert und im Ausgangsarray
* zusammengeführt.
*/
int[] arr = new int[intArr.length];
int i, j;
for (i = l; i <= q; i++) ... |
57e5d642-1e71-4c59-8d9e-0dd6f42a7613 | 6 | public static void main(String[] args) {
Scanner inFile = null;
try {
// Create a scanner to read the file, file name is parameter
inFile = new Scanner(new File(System.getProperty("user.dir")
+ "/src/Files/prog464a.dat"));
} catch (FileNotFoundException e) {
System.out.println("File not found!");
... |
08a69702-3ace-4fc0-b285-5f0127c33c76 | 4 | public static void main(String[] args) {
// Kundendaten initialisieren
String[][] clientArray = new String[][] {
new String[] { "921", "Holthuis", "Jan" , "Universitaetsstr. 150, 44801 Bochum"},
new String[] { "435", "Mueller", "Philipp" , "Thaelmannstr. 4, 12345 Berlin"},
new String[] { "205", "Koebele... |
a40ac36c-0498-44ea-b8a0-10ee3ffeb29b | 2 | private int aumentarVelocidad() {
int puntos = Integer.parseInt(jPuntaje.getText());
if (puntos == 150 || puntos == 300) {
velocidad = velocidad - 1;
}
return velocidad;
} |
a54e3404-aad0-47cc-98bb-150f68799858 | 6 | @Override
public boolean put( K key, V value )
{
HashSet< K > keys = null;
HashSet< V > values = null;
// Check for key and/or value in map
if( mapKV.containsKey( key ) )
{
// Key exists in map, get it's value set
val... |
d8248f53-433c-49a9-ac28-e9664166b40b | 0 | public void terminate() {}; |
2f715708-bd22-4f67-b1fc-4d5849a53586 | 3 | public int getLength() {
int length = 0;
for (int i = 0; i < glyphs.length; i++) {
Object o = glyphs[i];
if (o == null) {
continue;
}
if (o instanceof ByteBuffer) {
length += ((ByteBuffer) o).remaining(... |
8c221c07-7977-4b1a-898a-c705c41ff037 | 3 | public void testMinus() {
Period base = new Period(1, 2, 3, 4, 5, 6, 7, 8);
Period baseDaysOnly = new Period(0, 0, 0, 10, 0, 0, 0, 0, PeriodType.days());
Period test = base.minus((ReadablePeriod) null);
assertSame(base, test);
test = base.minus(Period.years(10))... |
86760e1c-9830-435f-863c-35b566f04ef0 | 0 | public DoublyLinkedList() {
this.head = null;
this.tail = null;
this.size = 0;
} |
5b29e7d7-c196-4750-8f6c-2d03cdb96a70 | 6 | @Override
public void run() {
try{
MathLogic mathLogic = new MathLogic();
ObjectOutputStream out = new ObjectOutputStream(clientSocket.getOutputStream());
ObjectInputStream in = new ObjectInputStream(clientSocket.getInputStream());
int[... |
ba8217c4-8142-44f3-a28c-d8c518806c68 | 5 | @Test
public void testBlackWins(){
World world = new World(150,150);
Game game = new Game(world, new BrainParser("C:/Users/mpp27/cleverbrain1.brain"), new BrainParser("C:/Users/mpp27/cleverbrain1.brain"));
int i = 0;
int y = 0;
int[] p = new int[2];
boolean found = false;
while(i < world.getRows() && !fo... |
e2c1112b-456e-4bdc-8490-e4bcbba9aa56 | 1 | public static void main(String[] args) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchProviderException, CertificateException, IOException {
/* Generate a DSA signature */
if (args.length != 3) {
System.out.println("Usage: GenSig nameOfFileToSign nameOfCert nameOfPriKey");
... |
a06dc394-2614-4981-bf74-1e39bd3bf7d7 | 2 | public Patient getPatient(int health_care_no) {
Patient patient = new Patient();
try {
if (selectPatientByHealthCareNo(health_care_no).next()) {
patient.setHealth_care_no(rs.getInt("health_care_no"));
patient.setName(rs.getString("name"));
patient.setBirth_day(rs.getDate("birth_day"));
patient.s... |
cdf7ee7c-389d-4ee8-ac67-42e1138d109c | 9 | private static TspPopulation[] generate(){
List<Graph> graphs = new ArrayList<Graph>();
for (int i = 0; i < GLOBAL_STEPS; ++i){
Graph g = new Graph(INDIVIDUAL_SIZE);
graphs.add(g);
}
TspPopulation[] h = new TspPopulation[GLOBAL_STEPS];
for (int i = 0; i < ... |
b5337080-aaad-4175-b819-226455907de3 | 4 | public ArrayList<Integer> zeroColumns(){
ArrayList<Integer> ret = new ArrayList<Integer>();
int nZero = 0;
for(int i=0; i<this.numberOfColumns; i++){
int m = 0;
for(int k=0; k<this.numberOfRows; k++){
if(this.matrix[k][i]==0.0)m++;
}
... |
c0b4cd07-1cc1-4b18-ad0a-0e6e09cb35e3 | 2 | public DataModel(String s) {
inputName = (s.trim()).split("[ __]")[0];
Pattern p_inputName = Pattern.compile(inputName
+ ",([^,]*),(-1|1),([^,0-9]+)");
Matcher m = p_inputName.matcher(namelist);
if (m.find()) {
registered = true;
if (m.group(1).equals("&i=1")) {
shift = 1;
wikiName = inputNam... |
16d91033-a3f4-4f3f-8171-3d1140fd1567 | 6 | public static void main(String[] args) {
int []primes = new int[N+1];
for(int i=0; i<=N; i++) {
primes[i] = 1;
}
for(int i=2; i<=N; i++) {
if(primes[i] != 0) {
for(int j=2*i; j<=N; j+=i) {
primes[j] = 0;
}
}
}
for(int i=2; i<N; i++) {
if(primes[i] == 1) {
System.out.print(i + " ... |
47967936-b2d4-4a36-b4f1-c304e1094b51 | 0 | public static double fp_bf(final int n, final int m, final int k) {
return Math.pow( Math.pow(1-(1-(1/(double)m)),(n*k)),k);
} |
d0fe0b1f-5c34-477d-aa2f-edba8718a64d | 8 | protected void makeSuccessors(FastVector BestFirstElements,Instances data,
int[][][] subsetSortedIndices, double[][][] subsetWeights,
double[][][] dists,
Attribute att, boolean useHeuristic, boolean useGini) throws Exception {
m_Successors = new BFTree[2];
for (int i=0; i<2; i++) {
m_S... |
49acb62a-392c-4ed8-bb42-00f217b5805b | 3 | public static void main (String[] args)
{
Wlist words = new Wlist();
String searchword;
words.add("hi");
words.add("bye");
words.add("xxx");
JOptionPane.showMessageDialog(null,"List: " + words);
searchword = JOptionPane.showInputDialog("enter a word to search for" );
if (words.isThere(search... |
ace34320-f509-4eb9-b3d0-e716b47b61a8 | 8 | public FetchFlags fetchFlags(String srchStr)
{
if(srchStr.length()==0)
return null;
srchStr=srchStr.toUpperCase();
if((srchStr.length()<2)||(srchStr.equals("THE")))
return null;
boolean allFlag=false;
if(srchStr.startsWith("ALL "))
{
srchStr=srchStr.substring(4);
allFlag=true;
}
else
if(... |
924af18a-e4f1-408a-bef9-55f626711043 | 1 | private void printResults() {
for (int i = 0;i<VALUE_ITERATIONS_NUMBER;i++) {
System.out.println(results[i]);
}
} |
450e59fc-e6d6-4cd4-b369-40fa223d6f8e | 6 | private boolean expr_sempred(ExprContext _localctx, int predIndex) {
switch (predIndex) {
case 0: return precpred(_ctx, 7);
case 1: return precpred(_ctx, 6);
case 2: return precpred(_ctx, 5);
case 3: return precpred(_ctx, 4);
case 4: return precpred(_ctx, 3);
case 5: return precpred(_ctx, 2);
}
r... |
dee2ba29-103c-4d6e-a646-6271c665345b | 2 | private void uploadSkinFile(String url) throws Exception {
try (CloseableHttpClient httpclient = HttpClients.createDefault()) {
HttpPost httppost = new HttpPost(url);
StringBody user = new StringBody(this.username, ContentType.TEXT_PLAIN);
StringBody sess = new StringBody(th... |
5a0c21d9-0d70-4951-9832-2de552973761 | 9 | private void buildTaskGroupStatistics() {
List<Statistic> schedulerTaskList = null;
List<Statistic> schedulerGroupList = null;
Statistic groupStatistic = null;
// Sum up all values
for (int i = 0; i < schedulers.length; ++i) {
schedulerTaskList = taskGraphStatistics... |
985fa5ac-3e41-4b19-b288-5fadb11ea051 | 8 | private ParkingSpace[] sendBestSpaces(XBeeAddress64 address) {
// Gets a list of all spaces best spaces that exist
ArrayList<ParkingSpace> trimmedSpaces = new ArrayList<>();
for (int i = 0; i < this.destinations.size(); i++) {
if (this.destinations.get(i).getBestSpace() != null) {
trimmedSpaces.add(this... |
bb7abe6b-4a88-4d29-9769-3674926eedc9 | 4 | private boolean canMoveDiagonal(Grid grid, Position pos) {
for (Element element : grid.getElementsOnGrid()) {
if (element instanceof Player
&& ((Player) element).getLightTrail().getPositions().contains(new Position(pos.getxCoordinate() + 1, pos.getyCoordinate()))
&& ((Player) element).getLightTrail().get... |
2c0e97ed-a536-4ac6-a7a2-542a99b13937 | 7 | private void putMarkInTheRandomPlace (Square square, Mark mark) {
Random rand = new Random(System.currentTimeMillis());
do {
switch (rand.nextInt(3)) {
case 0:
mark.setLeftCoord('1');
break;
case 1:
... |
a623d2f5-1f77-43ef-a784-1d0b726196f7 | 5 | public CheckResultMessage checkJ02(int day) {
int r1 = get(17, 2);
int c1 = get(18, 2);
int r2 = get(20, 2);
int c2 = get(21, 2);
BigDecimal b = new BigDecimal(0);
if (checkVersion(file).equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
b = getValue(r2 ... |
331b4c7b-5306-455d-93e1-43c17bf060c0 | 7 | @EventHandler(priority=EventPriority.LOWEST)
public void onPlayerCommand(PlayerCommandPreprocessEvent event) {
if(event.getMessage().replace("/", "").equalsIgnoreCase("1v1")) {
event.getPlayer().performCommand("join 1v1");
event.setCancelled(true);
} else
if(event.getMessage().replace("/", "").equals... |
993c3f2c-12da-4c25-9863-45172a661476 | 2 | public void addGroopsAndPersonnel(int trackNumber, Track toAdd) throws SQLException
{
// Now do the personnel
int[] artNums = GetArtists.create().addArtists(toAdd.getPersonnel());
// Add the entries in the personnel table
PreparedStatement ps = Connect.getConnection().getPreparedStatement(
... |
65546d41-0925-4947-86ac-62bf55d64624 | 2 | private int determineWin(Output drawOfFirstPlayer, Output drawOfSecondPlayer)
{
// first player triumphs over second?
if (drawOfFirstPlayer == _triumpher.get(drawOfSecondPlayer))
{
return 1;
}
// second player triumphs over first?
if (drawOfSecondPlayer =... |
4165482e-56f8-4b33-83a3-327c5b11d53e | 3 | @Override
public DemandeMoyen getDemandeMoyen(String dId) throws BadResponseException {
DemandeMoyen d = null;
JsonRepresentation representation = null;
Representation repr = serv.getResource("intervention/" + interId
+ "/demande", dId);
try {
representation = new JsonRepresentation(repr);
} catch (... |
019909db-d3ac-405f-a293-2f6a49608636 | 8 | public static boolean deleteInstances(HyperGraph graph, HGHandle type)
{
int batchSize = 100; // perhaps this should become a parameter
HGHandle [] batch = new HGHandle[batchSize];
for (boolean done = false; !done; )
{
HGSearchResult<HGHandle> rs = null;
try
{
int fetched = 0;
graph.getTrans... |
a720bc3d-5326-4676-87dd-08f50377a268 | 1 | public synchronized Image getImage() {
if (frames.size() == 0) {
return null;
}
else {
return getFrame(currFrameIndex).image;
}
} |
b5ae5e6e-1af4-4c1c-8db8-a3a29286a963 | 7 | private BufferedImage getImage(Cell m) throws IOException
{
if(m == null) return ImageIO.read(new File(path + "white.png"));
switch(m.getStatus())
{
case WUMPUS: return ImageIO.read(new File(path + "wumpus.png"));
case PIT: return ImageIO.read(new File(path + "pit.png"));
case GOLD: return ImageIO.re... |
3c8df5bf-e3d3-4f5d-adf4-174b0cf24617 | 1 | private void write_page (PageId pageno, Page page) throws
BufMgrException {
try {
SystemDefs.JavabaseDB.write_page(pageno, page);
} catch (Exception e) {
throw new BufMgrException(e, "BUFMGR: write_page() failed");
} // end try
} // end write_page() |
a32865a7-76e1-4f95-ac71-145569ba8972 | 1 | public static void listHiredEmployeesDate(EntityManager entityManager) {
TypedQuery<Employee> query = entityManager.createQuery(
"select e from Employee e where e.startDate between '2013/04/13' and '2014/04/25'",
Employee.class);
query.setMaxResults(2);
List<Employee> resultList = query.getResultList(... |
662488e0-2709-4771-aac8-7aed0a77a5c4 | 2 | public boolean equals( Vector3f r )
{
return x == r.getX() && y == r.getY() && z == r.getZ();
} |
4f3cb4b3-f0fc-4dd7-bb43-d395ff1726f0 | 2 | public static TextModifier compile(String...modifiers) {
TextModifier modifier = new TextModifier();
String[] typeValue;
for(String m : modifiers) {
if((typeValue = m.split("=")).length != 2) {
continue;
}
modifier.addModifier(typeValue[0], typeValue[1]);
}
return modifier;
} |
0c9ad779-e203-42db-860e-02df45197a02 | 6 | private void LoadWorld(int[][] objData) {
for (int i = 0; i < data.length; i++) {
for (int j = 0; j < data[i].length; j++) {
objs.add(new Block(i*32-data.length*32/2, j*32-data.length*32/2, data[i][j]));
}
}
if (objData != null) {
for (int i = 0; i < objData.length; i++) {
for (int j = 0; j < obj... |
6ceea2ab-a1ce-4d2f-8bbd-52cc1ee4e05f | 7 | public static void startupUnits() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/UTILITIES", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpecial(Stella.$CONTEXT$, ((Mo... |
5265a5a0-7bc2-4bef-9a4d-5a8949c49650 | 3 | public Inteline(Connector from, Connector to) {
super(from, to);
cpFrom = from.getParent();
cpTo = to.getParent();
panel = cpFrom.getPanel();
for (Component c : cpFrom.getPanel().getElements())
add(c);
Point mp = Component.getMidPoint(cpFrom, cpTo);
add(mp);
buildMap();
if (ndFrom == null || n... |
eb6412e7-ee9a-46c8-a5cf-7eb46503af7d | 2 | public void listFilesServer(ObjectInputStream input, ObjectOutputStream output) throws IOException
{
//lecture du pathname envoyé par le client
String dir = input.readUTF();
List<String> allFiles = new ArrayList<String>();
if (dir == null)
envoiConfirmation(output,false,"Pathname M... |
03df5603-bddf-4b43-8a7d-e55ea2cab079 | 3 | public void spawnXPCrystal(int x, int y, int xp) {
Resource r = new Resource(registry, this, this.getResourceTypeByName("XPCrystal"), x, y, xp);
r.setMapY(findNextFloor(x + r.getWidth(), y, r.getHeight()));
registerResource(r);
if (gameController.multiplayerMode == gameController.multip... |
0a0435fb-5093-4747-a146-a5aa3823b816 | 0 | public int getId(){
return id;
} |
5ce344be-8954-485d-8c87-a2016e27e36a | 4 | @Override
public void onDraw(Graphics G, int viewX, int viewY) {
if (X>viewX&&X<viewX+300&&Y>viewY&&Y<viewY+300)
{
G.setColor(Color.blue);
G.fillArc(((int)X-radius/2)-viewX, (int)(Y-radius/2)-viewY, radius, radius, 0, 360);
G.setColor(Color.cyan);
... |
72c46630-cece-4f54-8d14-121c7ea1403f | 9 | public void layoutContainer(Container target) {
synchronized(target.getTreeLock()) {
Dimension toolbarDim = preferredLayoutSize(target);
Insets insets = target.getInsets();
if(isHorizontal) {
int left = insets.left;
/*for (int i = 0; i < components.size(); i++) {
Component comp = (Component) co... |
c750062a-7ff0-4bb8-b544-72e6f608afc5 | 2 | private boolean isDone() {
return players > 0
&& (teamPlayerCount[TEAM_1.ordinal()] <= 0 || teamPlayerCount[TEAM_2.ordinal()] <= 0);
} |
134b616b-000c-42d3-b1dc-9ea734f28a14 | 9 | private boolean matchesStepThreePlaceTheMiddleLayerEdges() {
if (! matchesStepThreeAlignTheCenters())
return false;
RubiksCube rc = this.initialRcConfig;
// Check each lateral face
Cubie frontFaceEdgeCubie = rc.getCubie(2, 3, 3);
Cubie frontFaceCenterLeftCubie = rc.getCubie(1, 2, 3);
Cubi... |
16217f7c-1f9f-4c84-bd08-9314699f16da | 3 | public static int singleNumber2(int[] A) {
int res = 0;
int count = 0;
for (int i = 0; i < 32; i++) {
count = 0;
for (int j = 0; j < A.length; j++) {
if (1 == ((A[j] >> i) & 1)) count = count + 1;
}
res = res | ((count % 3) << i);
}
return res;
} |
4d3427d5-39ee-41df-a654-210e7adbf947 | 5 | public void init() {
ArrayList<Integer> positions = new ArrayList<Integer>();
for(int i=0; i<activeBoardSize; i++) {
for(int j=0; j<activeBoardSize;j++) {
positions.add(i*activeBoardSize+j);
}
}
Collections.shuffle(positions);
staticFences.clear();
activeFences.clear();
mhos.clear();
int... |
84439ae7-41f1-45e3-800b-68f93e8bd9e7 | 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... |
7b53a406-6071-4857-9960-014ae2a9ab65 | 3 | public boolean checkQty() {
int qty = 0;
boolean quntity = false;
try {
ResultSet rs = DB.myConnection().createStatement().executeQuery("select * from book where BookID='" + jTextField3.getText() + "'");
while (rs.next()) {
qty = Integer.parseInt(rs.getSt... |
6930ce38-6bd0-4d12-821d-1ab01e6687df | 3 | public AnimMissileShip(float width, float height, float size) {
anim_missile = new Animation();
SpriteSheet sp_fire = null;
try {
sp_fire = new SpriteSheet("resources/blue_fire_ball.png", 81, 46,
new Color(0, 0, 0), 1);
} catch (SlickException e1) {
e1.printStackTrace();
}
... |
a3289173-cbe0-4ea6-b63f-af37d9c4700b | 6 | public String getTaskAtTime(int time) {
if (this.initialized == false) {
throw new IllegalStateException("Aperiodic task queues must be initialized before they can be used.");
}
String taskName = null;
if (schedule.isEmpty() == false) {
if (time >= schedule.peek().getStartTime()) {
taskName = schedule... |
75ea2334-b8c2-461c-8694-7477e2a5bab9 | 6 | private int loadTexture(String root, String fileName)
{
if(!root.endsWith("/"))
root.concat("/");
String path = (root.length() <=1 ? Texture.root : root) + fileName;
try
{
CobaltUtil.log("Loading Texture: " + fileName);
BufferedImage bimg = null;
try{
bimg = ImageIO.read(new Fil... |
e09be230-fecc-4548-9d9f-8793c58fb3a2 | 0 | public void addHeader(String name, String value) {
header.put(name, value);
} |
7ceb4ec7-00df-4d6c-9a0a-8bbab8755772 | 9 | public boolean sliderAndSpinnerDispatch(ChangeEvent e) {
if (e.getSource() == simTimeSlider) {
changeSpinnerBasedOnSlider(); //will call updateSimChangeSpeedValues()
return true;
} else if (e.getSource() == simTimeDelaySpinner || e.getSource() == simTimeCycleSpinner) {
... |
3a5fcd1d-e64a-4a89-872f-9baffdac3d23 | 4 | private void trickleDown(int index) {
int largerChild;
BTPosition<T> top = heap.get(index);
while (index < size / 2) {
int leftChild = 2 * index + 1;
int rightChild = leftChild + 1;
if (rightChild < size
&& comp.compare(heap.get(leftChild).element(),
heap.get(rightChild).element()) < 0)
... |
bf0e0c9a-7f84-4e05-af4e-7084a23e937b | 6 | public int dup_x2s(final LocalExpr expr) {
int toReturn = 0;
final UseInformation UI = (UseInformation) useInfoMap.get(expr);
if (UI == null) {
if (StackOptimizer.DEBUG) {
System.err
.println("Error in StackOptimizer.dup_x2s: parameter not found in useInfoMap");
}
return toReturn;
}
toRe... |
8c76e11d-6a98-4b6a-a441-4e24966c8d1c | 7 | public static Vector AssignAllFrosh(Vector unAssigned, Integer tIndex) {
Vector froshOnly = new Vector();
System.out.println("unAssigned size " + unAssigned.size());
for (int i = 0; i < unAssigned.size(); i++)
System.out.print(unAssigned.get(i) + " ");
int i = 0;
while (i < unAssigned.size()) {
if (((S... |
3c8aa59d-fa5c-4ce5-a1c6-bd6fb2d6bfa5 | 8 | public static void parseOneVariableDeclaration(Stella_Object vdec, List localdeclarations) {
{ Symbol variablename = null;
Cons isatree = null;
PatternVariable variable = null;
{ Surrogate testValue000 = Stella_Object.safePrimaryType(vdec);
if (testValue000 == Logic.SGT_STELLA_CONS) {
... |
2516ce3c-ab09-439f-a87e-bed42285fec2 | 5 | @Override
public boolean execute(Entity actor, Entity target, Parameters context) {
String contextMinionType = context.getString(ParameterName.MINION_TYPE, "");
EnemyType minionType = contextMinionType.length() == 0? this.minionType : EnemyType.valueOf(contextMinionType);
for (Point summonLocation : Physics.getA... |
1dafdec9-80c4-4d90-a7e6-5635017fb283 | 9 | public void update(int delta) {
timeSinceLastUpdate += delta;
if (state == STATE_CLOSED) {
state = STATE_DESTROYING;
} else if( state == STATE_DESTROYING) {
if (timeSinceLastUpdate > 1000) {
state = STATE_DESTROY;
}
} else if (state == STATE_CLOSING) {
while (timeSinceLastUpdate > fillTime) {
... |
851e519d-9cf5-4744-bd2e-8e298f8feb23 | 9 | @EventHandler(priority=EventPriority.NORMAL)
public void pickup(PlayerPickupItemEvent event) {
ItemStack item = event.getItem().getItemStack();
item.setAmount(item.getAmount() - event.getRemaining());
Inventory inv = event.getPlayer().getInventory();
int quantity = BlockAPI.getCustomBlockAmount(item) * item.ge... |
9fea7c4e-17a3-4f0f-812b-9a1dd297d0f8 | 1 | private static String transformPasswordToHex(byte[] array) throws NoSuchAlgorithmException
{
BigInteger bigInteger = new BigInteger(1, array);
String hexValue = bigInteger.toString(16);
int paddingLength = (array.length * 2) - hexValue.length();
if(paddingLength > 0)
{
... |
757960ef-a834-46da-b3cb-2edc77a49be8 | 8 | private boolean vaihdaParinPaikka(int millainenPari) {
tokaPaikka = null;
this.ekaSitsaaja = ekaPaikka.getSitsaaja();
if (millainenPari == 1) {
tokaPaikka = ekaPaikka.getMiehenAvecinPaikka();
} else if (millainenPari == 2) {
tokaPaikka = ekaPaikka.getNaisenAvecin... |
2b905d11-c788-4a52-920b-471f0bb47c53 | 8 | public static final ArrayList<String> extractLines(String data, int tabWidth) {
int length = data.length();
StringBuilder buffer = new StringBuilder(length);
char ignoreCh = 0;
ArrayList<String> lines = new ArrayList<>();
int column = 0;
for (int i = 0; i < length; i++) {
char ch = data.charAt(i);
i... |
944988d5-f308-4d02-a5a8-fb246477f6ba | 6 | private final void initializeContexts() {
Iterator symbolIt = lsystem.getSymbolsWithReplacements().iterator();
Set searchLengths = new HashSet();
Integer one = new Integer(1); // It'll be quite common...
ArrayList contextsList = new ArrayList();
boolean hasContexts = false;
// Build the contexts.
while (s... |
d528815c-3dfc-4c3f-acfb-9eb35021f1f0 | 5 | private void addAuthAPsTab()
{
updateAPList();
sidePanel = new JPanel();
sidePanel.setBackground(new Color(windowColor));
sidePanel.setName("SidePanel");
JButton scanBtn = new JButton("Live Scan");
scanBtn.setToolTipText("Shows only result for last scan");
scanBtn.addActionListener(new ActionListener (... |
b2ca6f23-aa9c-4100-90e9-66dd8318c7c2 | 1 | public void onStart() {
if(log.isLoggable(Logger.INFO))
log.log(Logger.INFO, "onStart()");
ontology = WumpusPerceptionOntology.getInstance();
man = myAgent.getContentManager();
codec = new SLCodec();
man.registerOntology(ontology);
man.registerLanguage(codec);
} |
239058d2-dd5f-4cb6-aff2-cc933058858c | 9 | public int readSave() {
if (PlayerHandler.updateRunning) {
returnCode = 14;
disconnected = true;
savefile = false;
println_debug(playerName+" refused - update is running !");
}
if (PlayerHandler.isPlayerOn(playerName)) {
returnCode = 5;
disconnected = true;
savefile = false;
pr... |
6d159204-7881-48c1-97dc-09446aabfe10 | 4 | public static void main(String args[]) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
UIManager.put("Slider.paintValue", Boolean.FALSE);
} catch (UnsupportedLookAndFeelException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catc... |
65f76b4c-f6fd-455f-8306-1009af9df7d2 | 9 | @Override
public String displayText(MOB mob)
{
if((numRiders()>0)
&&(stateStringSubject(this).length()>0)
&&(displayText!=null)
&&(displayText.length()>0)
&&CMLib.flags().isWithSeenContents(this))
{
final StringBuffer sendBack=new StringBuffer(name(mob));
sendBack.append(" "+stateStringSubject(... |
c308a060-76bc-4e7d-aa09-952d46a6dfad | 2 | public void setTonsWeight(double tonsWeight) throws OutOfRangeException {
if (( tonsWeight < 0 )||( tonsWeight > MAX_TONS_WEIGHT )){
logger.error( "incorrect weight argument "+tonsWeight );
throw new OutOfRangeException();
}
this.tonsWeight = tonsWeight;
} |
ea481759-d681-42ec-9736-e015c530851a | 4 | public Object[] getTileDataFromXML(String xml, int IDtoGet){
Object[] returnObj = new Object[2];
String[] lines = xml.split("\n");
for(String line : lines){
String[] spaces = line.split(" ");
if(spaces.length > 1){
int currentID = Integer.parseInt(spaces[1].substring(4, spaces[1].length() - 1)... |
fd6a4095-e556-4c5e-b404-9966a2eed0da | 8 | @Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o instanceof FLFile) {
FLFile f = (FLFile) o;
if (this.path == null || f.path == null)
return false;
if (new File(this.path).equals(new File(f.path)) && (this.parent == null || f.parent == null || this.parent.equals... |
545ee9a2-38a5-479b-9e55-603801b6ce04 | 9 | @Override public void mouseDragged(MouseEvent e) {
Frame selected = getSelectedFrame();
if(selected==null) return;
if((e.getModifiersEx() & MouseEvent.BUTTON3_DOWN_MASK) == MouseEvent.BUTTON3_DOWN_MASK) {
if(parent.isSettingOffsetDirectly())
handleEditOffset(selected,e);
if(parent.isSettingOffsetWit... |
012a7fa9-e89b-4942-827f-2f896428b7c3 | 2 | private static void setPixelSaltAndPepper(Image original,
Image saltAndPepper, double minP, double maxP, double p,
ChannelType color, int x, int y) {
double pix;
if (p < minP) {
pix = 0;
} else if (p > maxP) {
pix = Image.MAX_VAL;
} else {
pix = original.getPixel(x, y, color);
}
saltAndPepper... |
404ab424-5ef8-4652-a176-33ab7b664b03 | 8 | public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
if (commandLabel.equalsIgnoreCase("locationset")) {
if (args.length == 1){
if (sender instanceof Player) {
if (sender.hasPermission("EventManager.LSet")){
File locations = new File (plugin.getDataFolde... |
c6d63df6-a370-49b7-a2f4-c4240040b2d8 | 1 | public long getAverage() {
long sum = 0;
for (int i = 0; i < duur.size(); i++) {
sum += duur.get(i).longValue();
}
return sum / duur.size();
} |
7ee97c4f-f319-4179-97b0-ce9c2f7df89a | 8 | @SuppressWarnings("rawtypes")
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Pair other = (Pair) obj;
if (this.first != other.first && (this.first == null || !this.first.equals(other.first))) {
return ... |
2f10ac55-7ca4-43a3-8df9-ba3d69275405 | 4 | public void decrypt(RandomAccessFile in, OutputStream out) throws Exception {
int block_size = dcipher.getBlockSize();
int read = 0;
byte[] header = new byte[2];
int len = 0;
System.out.println("Decrypted file:: ");
while (in.read(header, 0, 2) != -1 && ((header[0] & 0xff... |
3a38a1f7-0037-4bc5-9379-e0860757345d | 8 | static boolean dijkstra(double a){
Arrays.fill(sol,Double.POSITIVE_INFINITY);
Arrays.fill(ant,-1);
Arrays.fill(vis,false);
sol[S]=0;
vis[S]=true;
PriorityQueue<double[]> cola=new PriorityQueue<double[]>(N,new Comparator<double[]>(){
public int compare(double[] o1,double[] o2){
if(o1[0]<o2[0])return -... |
2a152e92-68f1-422f-bb87-96703d885002 | 7 | public boolean setDestination(Vector3D dest) {
if (getBrain().isDebugging())
getBrain().println("Navigator asked to plot path from " + getBrain().getLocation() + " to " + dest);
uk.ac.derby.GameEngine2D.Map map = getBrain().getBlurredMap(mapScale, mapBlur);
// Get start of A* (which is where we want to go) loc... |
791ad9e5-7c53-4810-99f9-5dc0c932e762 | 9 | public void drawPatches() {
for (int i = 0; i < width / scale; i++) {
for (int j = 0; j < width / scale; j++) {
if (patches[i][j] != null) {
_patchDisplay.remove(patches[i][j]);
}
}
}
for (int i = 0; i < width / scale; i... |
6160e42f-7f36-447c-a52c-7b29619908de | 4 | public M_Combo_Box_Change_Appointment_Information() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException
{
//MAIN FRAME
super("Team J's Scheduler | Change Appointment Information");
setBounds(50,50,500,300);
setResizable(false);
setDefaultCloseOperation(JFrame.DISPOSE_O... |
179fadc9-14d8-43ce-8593-4257507d9aff | 5 | private DummyAction getActionFromSnapshotFile(SnapshotFile file) throws IOException {
State state = file.getState();
DummyAction action = null;
if (state instanceof New) {
action = new DummyAdd(file.getFilename(), file.getSize());
this.totalBytes += file.getSize();
} else if (state instanceof Modifie... |
e104785b-9d5a-4972-bb93-4a9cdd717ad4 | 2 | public void addItem(MenuItem item){
for(int i = 0; i < items.size(); i++){
if(items.get(i) == null){
items.add(i, item);
break;
}
}
} |
06629021-4ac4-4a97-806d-478b20d8c106 | 1 | public static void main(String[] args) {
// Create game
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
e.printStackTrace();
}
final Game game = new Ga... |
5bf98611-8706-4516-8ae1-e89dc3444f7e | 4 | protected void LoadTxtDoc(String filename) {
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(filename), "UTF-8"));
StringBuffer buffer = new StringBuffer(1024);
String line;
while ((line = reader.readLine()) != null) {
buffer.append(line);
}
reader.clo... |
b3e5feba-f692-45e5-a995-29ae3ccca9d5 | 0 | public void windowClosing(WindowEvent e) {
System.out.println("Die Anwendung wird geschlossen...");
System.exit(0);
} |
a159fec7-4ddb-4cfe-8f56-8602da944854 | 1 | private void setBattleState() {
if (field.getBattleState() == eFieldBattleState.Hit) {
setBackground(Color.red);
setText("X");
} else {
setBackground(Color.blue);
setText("~");
}
setEnabled(false);
} |
e3338317-26a9-4031-bcbe-0ebfa9a43b0d | 9 | private String[] read() throws IOException, FileFormatException {
String line;
String id = null;
StringBuffer s = new StringBuffer();
while ((line = readLine(buffer)) != null) {
if (line.isEmpty())
// if line is empty continue
continue;
if (Pattern.matches(FASTA_ID, line) && id != null) {
... |
6f135bd1-d262-4a09-a2cb-27e4087dde0a | 3 | private boolean isValidEmpNum(String employeeNumber){
boolean isValid = false;
if(employeeNumber.length() != 3){
return false;
}else{
for(int i = 0;i < employeeNumber.length(); i++){
if(Character.isDigit(employeeNumber.charAt(i)))
... |
808df10a-622b-4c38-988a-e33018af1a67 | 5 | public void run() {
System.out.println("run(): begin");
try {
while (true) {
// System.out.println("run(): awake");
sample = sampleAll(strings);
StdAudio.play(sample);
ticAll(strings);
// Here's where the thread does some work
++i;
if ( i == 10 ) {
i = 0;
}
// showSta... |
2418bd3c-5fc6-47bb-9088-969217050ee6 | 2 | public int getIntProperty(String prop, int defaultValue) {
String value = getProperty(prop);
int returnValue = defaultValue;
if (value != null) {
try {
returnValue = Integer.parseInt(value);
} catch (NumberFormatException e) {
LOG.error("getIntProperty: Property value not an int. prop=" + prop + ",v... |
4663f676-a9c7-4fc2-83ce-80109d0c75fb | 3 | @Override
public int hashCode() {
int hash = 7;
hash = 71 * hash + (this.mapID != null ? this.mapID.hashCode() : 0);
hash = 71 * hash + (this.map != null ? this.map.hashCode() : 0);
hash = 71 * hash + (this.cell != null ? this.cell.hashCode() : 0);
return hash;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.