method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
64d2d317-1a96-4ad8-8099-a093bf1df169 | 0 | public ArrayList<Grid> getPreviousGrids() {
return previousGrids;
} |
8bf64885-0c1e-433d-9bda-f0e5e8d06ec1 | 9 | private static final <E> boolean mergesort(final Entry<E>[] source,
final Entry<E>[] target,
final int fromIndex,
final int toIndex) {
final int RANGE_LENGTH = toIndex - f... |
9360aac3-e3db-43f3-82ab-c3f426235deb | 9 | public void createParticle(int x, int y, byte id, byte[][] Map) {
for (int i = 0; i < var.reaction[7]; i++) {
if (Map[x][y - 1] == -127) {
Map[x][y - 1] = id;
} else if (Map[x][y + 1] == -127) {
Map[x][y + 1] = id;
} else if (Map[x + 1][y] == -... |
83ba765c-8624-42df-9248-e4cb3e6a1d21 | 4 | public static BufferedImage getSubImage(Image image, int x, int y, int width, int height) {
if (x >= image.getWidth(null)) {
throw new IllegalArgumentException("The given x, " + x + ", must be less than the image width, " + width + ".");
}
if (y >= image.getHeight(null)) {
... |
b5e3fde5-49b7-4ae0-b8ac-2c23833f4849 | 9 | public void interpretUserResponse(String response){
HashMap<String, String> userResponseInDetail = new HashMap<String, String>();
userResponseInDetail = jsonParser.decodeUserResponse(response);
Utils.printWithDate("Response at: " + userResponseInDetail.get("displayDate") + " type: " + userResponseInDetail.get... |
2c49dc54-2f8c-4c33-b1b6-16f8b1b9394d | 9 | @Override
public void insertSorted(Comparable _value, boolean _ascending)
throws ValueException {
DLNode current = this.head;
if (head == null) {
DLNode insertNode = new DLNode(_value);
head = insertNode;
tail = head;
} else {
if (!isComparable(head.getVal(), _value)) {
throw new ValueExcepti... |
0d921e43-4ffc-40c3-a666-c8494c95356f | 9 | public Boolean run(CommandSender sender, String[] args) {
MonsterHuntWorld world = HuntWorldManager.getWorld(((Player) sender).getWorld().getName());
if (world == null || world.getWorld() == null) return true;
if (world.Score.containsKey(((Player) sender).getName()))
{
Util.Message(world.settings.getString... |
9ff24c72-ecf7-4492-9862-5bf3b43a5400 | 6 | public boolean checkDate(JTextField input) throws Exception{
String date = null;
try{date = input.getText();} catch (NullPointerException e){
return false;
}
if(date.length() == 0){
return false;
}
if(date.length() != 10){
exceptionThrower();
return false;
}
try{
Integer.parseInt(date.substring(0,4... |
423aa342-9c48-41d6-b848-5a43d55ef94a | 0 | public int GetX()
{
return this.x;
} |
08d407a2-f56e-4814-85b5-324b990937d3 | 6 | @Override
public void run() {
//Basic packetloss check
int packetsLost = 0;
while(true) {
if(packetsLost<11) {
try {
Object o = in.readObject();
if(o instanceof String) {
// System.out.println("Got str... |
613d0694-c687-42e8-9958-10e785533d87 | 8 | public static Set<String> findWordsInterrogative(CompositeText document,
int wordlength) {
if (wordlength < 0) {
LOGGER.error("Word length parameter must be positive");
throw new IllegalArgumentException(
"Word length parameter must be positive");
}
Set<String> words = new TreeSet<String>();
Itera... |
dd34e6ed-2c86-4d03-8570-1e1297dd1443 | 9 | public boolean isLegalMove(double newBearing) {
// because 0 and 360 are the same, this makes things a little easier
if (newBearing == 360) newBearing = 0;
// make sure it's in bounds
if (newBearing < -2 || newBearing > 360) {
System.err.println("ERROR! " + newBearing + " is not a legal bearing");
retu... |
967d0015-752a-44e4-b98b-5e2fb56ebf20 | 9 | @Override
public boolean equals(Object obj){
if(this == obj)
return true;
if(obj == null)
return false;
if(getClass() != obj.getClass())
return false;
PrimitiveSite other = (PrimitiveSite) obj;
if(type == null){
if(other.type != null)
return false;
}
else if(!type.equals(other.type))
r... |
caa009e1-7793-4876-a62d-b10684be2782 | 8 | private void updateTaoRankings() {
if (lastRBRanking > 0) {
if (taoRankings != null) {
taoRankings.clear();
}
if (taoRankingsByName != null) {
taoRankingsByName.clear();
}
}
Connection con = DatabaseConnection.getCon... |
d2646841-9ab2-4154-b5f1-0939f0659cab | 9 | public final DirkExpParser.memberFunctionExpr_return memberFunctionExpr() throws RecognitionException {
DirkExpParser.memberFunctionExpr_return retval = new DirkExpParser.memberFunctionExpr_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
DirkExpParser.fieldPropertyExpr_... |
bd346fa1-663f-4a36-9cb8-d6a4f140b274 | 4 | public Recipe addRecipe(String recipeURL){
Document doc = null;
try {
doc = Jsoup.connect(recipeURL).get();
} catch (IOException ex) {
Logger.getLogger(ProductRetriever.class.getName()).log(Level.SEVERE, null, ex);
}
//System.out.println("!=!=!=!=!=!=!=!=!... |
fc3de6d1-fd72-4e34-98c8-568492834958 | 6 | private void field_codigoFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_field_codigoFocusLost
if (field_codigo.isEditable() && (lab_modo.getText().equals("Alta"))){
if ((evt.getOppositeComponent()!=null)&&(!evt.getOppositeComponent().equals(btn_cancelar))){
if (!field_co... |
71c8b779-72ab-4c1d-b9ba-6fbd70cb57d1 | 8 | public int sprawdzJakiObiektTrafiony(int posX, int posY, Plansza plansza){
int trafioneId = 0; // lokalna zmienna przechowujaca id obiektu trafionego z listyPozycji
int pozStat = 0;
// Wyszukanie trafionego id
for (int i = 0; i < plansza.pozycjeSta... |
9dd203b5-b67f-4028-a1ff-2c5d0153010c | 6 | public static boolean enter(SynchronizedBlock synBlock, StructuredBlock last) {
if (!(last.outer instanceof SequentialBlock))
return false;
/* If the program is well formed, the following succeed */
SequentialBlock sequBlock = (SequentialBlock) synBlock.outer;
if (!(sequBlock.subBlocks[0] instanceof Instru... |
b7fe9ac8-adb0-466f-8c54-33bb95d2a834 | 3 | public void encode() throws IkszorConvertException {
this.isEncoded = false;
try {
boolean[] key = IkszorManager.string2BooleanArray(this.symmetricKey);
boolean[] dValue = IkszorManager.string2BooleanArray(this.decodedValue);
boolean[] result = new boolean[dValue.length];
for(int i = 0;i < dValue.le... |
4215d1d9-562a-43ee-82b9-907a15afe575 | 1 | public LinkedList<User> getMostUsefulUsers(int amount) throws SQLException {
PreparedStatement statement = connection.prepareStatement(
"SELECT Username, Name, CreditCard, Address, Phone, IsManager FROM Users " +
"ORDER BY (SELECT AVG(Score) FROM Usefulness WHERE Reviewer... |
b62656f3-bfc2-49b3-9289-0ccee3c17988 | 2 | public void runClient()
{
try // connect to server, get streams, process connection
{
connectToServer(); // create a Socket to make connection
getStreams(); // get the input and output streams
processConnection(); // process connection
} // end try
catch ( EOFExcep... |
6974f386-c4e5-4131-87ec-9f2c2f46bdac | 0 | private void onOK()
{
dispose();
} |
a2f6697b-d3e9-45fc-9904-c53b5efb0e04 | 1 | public static void main(String[] args) {
int[] heap = new int[] { 1, 3, 7, 5, 2, 8, 4, 6, 10, 9 };
int temp;
printArray(heap);
createHeap(heap); //创建堆(对该堆进行简单的排序)
printArray(heap);
for (int i = heap.length - 1; i > 0; i--) {
temp = heap[0];
heap[0] = heap[i];
heap[i] = temp;
printArray(heap);
... |
f4add641-bfb2-4973-90e0-9554c34ca1b1 | 9 | }
@SuppressWarnings({ "unchecked", "rawtypes" })
public static void main(String args[]) throws IOException
{
Comm.init(args);
world=Comm.world();
rank=world.rank();
size=world.size();
ObjectBuf<List<String>> gather;
Scanner scan;
Map<String,String> choices=new HashMap<String,... |
7102c37c-6a8d-43c7-8ecb-6ad8017347b4 | 7 | public void runTournament(int botsPerGame, int gameRepeats)
{
for(Player p : allPlayers){
p.resetStatistics();
}
numGamesCompleted = 0;
if(participatingPlayers.size() < 2 || gameRepeats < 1){
return;
}
if(botsPerGame > participatingPlayers.size()){
botsPerGame = participatingPlayers.size();
}... |
e6551744-ffd5-414d-b1f5-9228a35eaba5 | 3 | protected synchronized void onResized(int columns, int rows)
{
TerminalSize newSize = new TerminalSize(columns, rows);
if(lastKnownSize == null || !lastKnownSize.equals(newSize)) {
lastKnownSize = newSize;
for(ResizeListener resizeListener: resizeListeners)
r... |
45191215-44f1-4455-a3e8-824d5460e8ab | 5 | private void readFromFile() throws Exception{
FileReader fr = null;
try{
fr = new FileReader(fileName);
BufferedReader br = new BufferedReader(fr);
String s;
text = new StringBuffer();
while((s = br.readLine()) != null){
... |
3ce43c4a-0992-4dba-b9d8-192ecd39347b | 1 | public Log parser(String logStr) throws ParseException{
List<Record> records = new ArrayList<Record>();
String[] recordStr2= logStr.split(System.getProperty("line.separator"));
for(String recordStr : recordStr2){
recordPars = new RecordPars();
records.add(recordPars.parser(recordStr));
}
... |
b72437f2-86c8-419d-8c4d-6f3b11dc94ba | 3 | private double attitudeConverter(String attitude)
{
double convertedAttitude;
if (attitude.equals("Supportive"))
convertedAttitude = 0;
else if (attitude.equals("Mixed"))
convertedAttitude = 1.0/3.0;
else if (attitude.equals("Marginal"))
convertedA... |
d8adb0ae-be36-46a0-a618-69c29371d248 | 4 | public ArrayList<String> getColumnName(String report){
ArrayList<String> column = new ArrayList<>();
if(report.equals("Daily time record summary")){
column.add("Seq no.");
column.add("Name");
column.add("Position");
column.add("RDW");
column.add("ROT");
column.add("RNSD");
column.add("LH");
... |
200778a4-701c-495e-ad66-c22159ec556e | 5 | protected void printWordTopicDistribution(_Doc d,
File wordTopicDistributionFolder, int k) {
String wordTopicDistributionFile = d.getName() + ".txt";
try {
PrintWriter pw = new PrintWriter(new File(
wordTopicDistributionFolder, wordTopicDistributionFile));
_Doc4DCMLDA DCMDoc = (_Doc4DCMLDA) d;
for... |
d35ec218-7296-4d76-9674-c74e5eb515c9 | 2 | public void run() {
try {
try {
do {
connect();
RemoteUI rui = new RemoteUI(sess);
ui = new TestUI(new Coord(800, 600), sess);
rui.run(ui);
} while(loop);
} catch(InterruptedException e) {
}
} finally {
stop();
}
} |
06bb2d07-df40-486c-8e15-f52dc9ff945e | 4 | private boolean isBlackValid() {
if (isLeaf()) {
return true;
} else {
if (hasRightChild() && hasLeftChild()) {
return getRightChild().blackDepth() == getLeftChild()
.blackDepth();
} else if (hasLeftC... |
5b0777d8-6d8f-412b-9f6b-29221a23d684 | 7 | public void draw_data(Graphics g, Rectangle bounds) {
Color c;
if (xaxis != null) {
xmax = xaxis.maximum;
xmin = xaxis.minimum;
}
if (yaxis != null) {
ymax = yaxis.maximum;
ymin = yaxis.minimum;
}
xrange = xmax - xmin;
yrange = ymax - ymin;
/*
* * Clip the data window
*/
if (cli... |
3a0a1723-bd9c-443e-ae36-be244cb70230 | 4 | public byte[] toByteArray() {
byte[] bytes = new byte[SETTINGS_SIZE];
byte[] liBytes = TypeConverter.unsignedShortToBytes(logIntervalMS);
bytes[0] = liBytes[0];
bytes[1] = liBytes[1];
byte[] huBytes = TypeConverter.floatToBytes(heightUnits);
bytes[2] = huBytes[0];
bytes[3] = huBytes[1];
bytes[4] = huByt... |
c869e01e-d8a3-4c67-876f-6cb4dc1ce481 | 0 | public boolean isStartet(){
return started;
} |
ebd5e947-d362-4c3b-a1b6-0ced3f41c97b | 0 | public static void main(String[] args) throws Exception {
Logon a = new Logon("USER", "PassWord");
System.out.println("Session a = " + a);
ObjectOutput out = new ObjectOutputStream(new FileOutputStream("Logon.out"));
out.writeObject(a);
out.close();
a = null;
Tim... |
2c3f2059-7565-4a48-a3d4-cf3f7426e8e6 | 7 | protected int request(IRequest request) throws NotInRoomException
{
// Check that it's not already completed
if(request.isCompleted())
{
// Warn and return
if(JeTT.isDebugging())
System.err.format("Ignoring completed request (%s)\n", request.toString());
return -1;
}
// Are we in a room?
if... |
2833d334-689b-4e85-93e0-368f73d2351a | 3 | public void cambiarPosicionJugado1(){
for(int x=0;x<8;x++){
for(int y=0;y<8;y++){
if(pd.mapa_jugador2[x][y].equals(codigo))
pd.mapa_jugador2[x][y]="";
}
}
int x=rd.nextInt(0)+7;
int y=rd.nextInt(0)+7;
set... |
7be0b97d-04f5-413e-be56-5dca5e1825a3 | 4 | public boolean checkhit(Coord c) {
c = c.add(ul().inv());
if((c.x < 0) || (c.y < 0) || (c.x >= img.sz.x) || (c.y >= img.sz.y))
return(false);
int cl = img.img.getRGB(c.x, c.y);
return(Utils.rgbm.getAlpha(cl) >= 128);
} |
13284a86-7542-43fc-9523-2dcbe18368b4 | 9 | private double surfaceChargeDensity2(double psi){
double surCharDen = 0.0D; // temporary values of surface charge density
// bisection method
double sigmaAdsPos = 0.0D;
double sigmaAdsNeg = 0.0D;
for(int i=0; i<this.nonZeroAssocK; i++){
if(this.charges[indexK[i]]>... |
dfc21c45-4a90-426b-803b-8a914cae28d2 | 9 | private static void writeJars() {
// First, determine which jars have actually changed.
for (IbiscEntry e : allClasses.values()) {
if (e.getModified()) {
JarInfo j = e.getJarInfo();
if (j != null) {
j.setModified(true);
}
... |
90a45c0d-6c87-4814-9592-1f0a594f3114 | 7 | @Override
public boolean addAnotherGreaterOfferAlert(boolean value, AuctionBean auctionBean) {
ObjectComparator objectComparator=new ObjectComparator();
if(this.getRole().equals(RoleEnum.BUYER)|| this.getRole().equals(RoleEnum.SELLER_BUYER)){
//il faut que l'enchere ne sois pas a l'utilisateur
if(this.get... |
93da54df-9f0a-4920-837b-7eee0f73cbf4 | 1 | public float variance() {
float mean = mean();
float totalDiff = 0;
for (float x : data) {
totalDiff += (mean - x) * (mean - x);
}
return totalDiff / data.size();
} |
6cb74a50-a0b4-4382-9f42-a3aea6fb8906 | 7 | private void addLayers(Element parent, Layers layers) /*throws XMLStreamException*/ {
if (layers == null || layers.getSize() == 0)
return;
//Check if there are non-empty layers
boolean foundNonEmptyLayer = false;
for (int i=0; i<layers.getSize(); i++) {
if (layers.getLayer(i).getSize() != 0)
{
f... |
da40e85c-e6a4-48ce-80de-22b4e1ad0b9a | 4 | public void setState(boolean active) {
if(c == null) {
System.out.println("[DcClient " + alias +"] Can not switch states without being connected to a server.");
return;
}
if(isActive == active) {
System.out.println("[DcClient " + alias +"] This client is already in " + (isActive?"active":"idle") + " stat... |
7adbb908-0e03-4f91-b910-463577db5a4b | 6 | private void connect(Boolean sleep) {
if(sleep) {
try {
sleep(10000);
} catch(InterruptedException e) {
e.printStackTrace();
}
}
try {
socket = new Socket(ip, port);
out = new PrintWriter(socket.getOutputStream(), true);
in = new BufferedReader(new InputStreamReader(socket.getInputStream... |
ea0032b1-1ae8-4624-90e7-4be8ffcff4e0 | 7 | private void drawMouse(final Graphics g) {
final Point location = Mouse.getLocation();
while (!MOUSE_PATH_POINTS.isEmpty() && MOUSE_PATH_POINTS.peek().isUp())
MOUSE_PATH_POINTS.remove();
Point clientCursor = Mouse.getLocation();
MousePathPoint mpp = new MousePathPoint(clientC... |
f5c4a6f2-efcc-4654-857a-8430586f5dd0 | 5 | @Override
public void mousePressed(MouseEvent e)
{
if (graphComponent.isEnabled()
&& !graphComponent.isForceMarqueeEvent(e) && isEnabled())
{
Iterator<mxCellHandler> it = handlers.values().iterator();
while (it.hasNext() && !e.isConsumed())
{
it.next().mousePressed(e);
}
}
} |
b6501e6d-8b31-40b5-b4f7-c12588b121dc | 4 | synchronized void toggle(boolean pressed) {
wasDown = isDown;
isDown = pressed;
if (isDown && !wasDown) {
InputHandler.getInstance().notifyListeners(this, true);
} else if (wasDown && !isDown) {
InputHandler.getInstance().notifyListeners(this, false);
}
} |
674b3f58-2864-4d23-aa46-440b95e7d2eb | 8 | private void updateGui() {
if (generating) {
generateButton.setEnabled(false);
cancelButton.setEnabled(true);
zoomOutButton.setEnabled(false);
zoomInButton.setEnabled(false);
northButton.setEnabled(false);
eastButton.setEnabled(false);
... |
8f040c38-6279-432c-92fb-fc71a916a080 | 5 | private static Move ForwardLeftCaptureForBlack(int r, int c, Board board)
{
Move forwardLeftCapture = null;
if(r>=2 && c<Board.cols-2 &&
(
board.cell[r-1][c+1].equals(CellEntry.white)
|| board.cell[r-1][c+1].equals(CellEntry.whiteKing)... |
310aa0f0-fe72-43f8-8194-81d9a76e11ca | 8 | public static String decodeDataCodingScheme(Pdu pdu)
{
StringBuffer sb = new StringBuffer();
switch (PduUtils.extractDcsEncoding(pdu.getDataCodingScheme()))
{
case PduUtils.DCS_ENCODING_7BIT:
sb.append("7-bit GSM Alphabet");
break;
case PduUtils.DCS_ENCODING_8BIT:
sb.append("8-bit encoding");
... |
592fa4d1-0b79-43b4-8d2d-8d3db7b8a32d | 2 | public LinkedList<Long> getTop(int n) {
try (Statement statement = openStatement();) {
LinkedList<Long> result = new LinkedList<>();
ResultSet rs = statement.executeQuery( "SELECT * " +
"FROM scores " +
"ORDER BY time " +
"LIMIT " + n);
while (rs.next()) {
result.add(rs.getLong("time"));
... |
64662225-2872-4ef4-91a5-a205bd53009f | 1 | private void addAnswerToList(String answer)
{
myJListModel.removeAllElements();
for (int i=0; i<answer.length(); i++)
{
myJListModel.addElement(answer.substring(i,i+1));
}
} |
bad06170-0154-4028-88e0-46f46a527538 | 4 | * constraint as returned by getConnectionConstraint.
*/
public mxPoint getConnectionPoint(mxCellState vertex,
mxConnectionConstraint constraint)
{
mxPoint point = null;
if (vertex != null && constraint.point != null)
{
point = new mxPoint(vertex.getX() + constraint.getPoint().getX()
* vertex.getWi... |
cf423dda-1f56-4d19-b3af-97026e997782 | 9 | public static void main(String[] args) {
int N = Integer.parseInt(args[0]);
// add elements 1, ..., N
System.out.println(N + " random integers between 0 and 99");
DoublyLinkedList<Integer> list = new DoublyLinkedList<Integer>();
for (int i = 0; i < N; i++)
list.add((int) (100 * Math.random()));
System.o... |
75a24acc-2d82-4263-be7f-3eeb910871d6 | 2 | public boolean newUser() {
boolean loggedIn = false;
System.out.println("Username: ");
_username = _scanner.nextLine();
System.out.println("Password: ");
_password = _scanner.nextLine();
try {
loggedIn = _remoteObj.newUser(_username, _password, ServerInterface.CLIENT);
} catch(Exception ex) {
if(... |
6273e417-f74d-4e08-8a01-a649f11c9c75 | 9 | @Override
public void visitFieldInsn(final int opcode, final String owner,
final String name, final String desc) {
mv.visitFieldInsn(opcode, owner, name, desc);
if (constructor) {
char c = desc.charAt(0);
boolean longOrDouble = c == 'J' || c == 'D';
sw... |
0e185a81-a6e6-4c71-9344-223d5b038e79 | 7 | @EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerRespawn(PlayerRespawnEvent event) {
DataWorld worldDied = plugin.getWorlds().get(playerDiedInWorld.get(event.getPlayer().getName()));
if (worldDied == null) {
System.out.println("Player " + event.getPlayer().getName() + " died, but i don't k... |
65ab9e19-0834-469a-b89a-dde0a1aefbfa | 0 | public String getId() {
return this.id;
} |
46d3674e-86ad-495c-a093-5683f188b8f4 | 2 | public static PermissionType get(String name) {
for (PermissionType type : values()) {
if (type.name().equalsIgnoreCase(name)) {
return type;
}
}
return null;
} |
95b8ea86-fc0c-45b7-b44d-42adcd061198 | 0 | TrackerError(String message) {
this.message = message;
} |
05c91fe6-4244-4655-9cd7-65ec28621245 | 2 | public void updateLastYear()//go back a year
{
int temp = currentYear.getNumber();//the year before switching years
ArrayList <Year> years = CalendarProject.getYears();//get the years from the Calendar project
if(currentYear.getNumber()>2013)
currentYear = years.get(currentYear.getNumber()-2013-1);
ArrayLis... |
94d23e9d-2e1f-4fd9-a5a2-f7976563af0e | 7 | @Override
public String toString() {
String aStr = a != 0 ? a + "x" : "";
String bStr = b != 0 ? (b < 0 ? (Double)(b * -1) : b).toString() : "";
String eqStr;
eqStr = !aStr.isEmpty() && !bStr.isEmpty() ? aStr + (b > 0 ? " + " : " - ") + bStr : aStr + bStr;
eqStr = eqStr.equa... |
f49a8e50-ebe2-4c01-a03a-04b79cca382e | 0 | public boolean contains(Configuration configuration) {
return configurationToButtonMap.containsKey(configuration);
} |
2e825ce0-712a-47d6-bc8c-90b160a6101b | 5 | public Wire(Circuit c, Color col, boolean orientation, int px1, int py1, int px2, int py2, Wire previous) {
this.circuit = c;
this.prev = previous;
if (this.prev != null) {
this.color = this.prev.color;
px1 = this.prev.x2;
py1 = this.prev.y2;
this.prev.next = this;
} else {
this.color = col;
}... |
4352db72-4c24-4061-a63b-b67dfab6e440 | 6 | public void refactorViews(){
int x=getXpos();
int y=getYpos()+20;
int c=radialCols;
for(int i=0;i<getScrollables().size();i++){
RadialButton temp=(RadialButton)getScrollables().get(i);
boolean one=temp.getIndex()>getIndex();
boolean two=temp.getIndex()... |
0eab15ec-fec4-4bbe-97c3-eb1feca5fe0a | 7 | private void applyParams() {
if (fis != null) {
for (int k = 0; k < fis.length; k++) {
if (getPanel() != null)
for (Parameter p : getPanel().getParams()) {
if (fis[k].hasVariable(p.getName())) {
fis[k].setVariable(p.getName(), p.getValue());
}
}
for (Parameter p : params) {
... |
8c7312f3-b0fc-4cb6-bd7e-db695487bb92 | 7 | public static Type canonicalize(Type type) {
if (type instanceof Class) {
Class<?> c = (Class<?>) type;
return c.isArray() ? new GenericArrayTypeImpl(canonicalize(c.getComponentType())) : c;
} else if (type instanceof ParameterizedType) {
ParameterizedType p = (ParameterizedType) type;
... |
7f5a42d3-cb9c-4b3b-a5c8-50a0ab82ca72 | 1 | public void test_compareTo() {
assertEquals(0, MillisDurationField.INSTANCE.compareTo(MillisDurationField.INSTANCE));
assertEquals(-1, MillisDurationField.INSTANCE.compareTo(ISOChronology.getInstance().seconds()));
DurationField dummy = new PreciseDurationField(DurationFieldType.seconds(), 0);
... |
97158158-196a-472c-98c2-29f4a1797a0d | 9 | private void update() {
checkPause();
if (this.hasFocus() && g.state == 1 && !pause) {
tick++;
if (tick % 60 == 0) g.time++;
updateControls();
if (tick % ySpeed == 0) {
sound.playSound(5);
yPos++;
checkCollision();
initObjCoord();
}
if (xSpeed != 0 && tick % xSpeed == 0) {
chec... |
315a0e3f-8aaa-4b97-bc7d-ff90be3c0649 | 7 | public void writeStatistics(){
try{
BufferedWriter writer = new BufferedWriter(new FileWriter(Maximums,true));
for (int i=0;i < iterationsLimit;++i){
for (int j=0;j<2;++j){
writer.write(dataMax[i][j] + " ");
writer.flush();
... |
dcae0607-ac84-419f-a879-7040d050ae76 | 0 | public Long getId() {
return id;
} |
79557fdf-c9d3-4ba0-a1ec-c31c803facd8 | 1 | public static double processValueHouse(ValueHouse valueHouse) {
Random gen = new Random();
long timeStart = System.currentTimeMillis();
while (!valueHouse.canBeLifted()) {
//Random balloon volume 3..4mm^3
double balloonVolume = gen.nextDouble()%0.001 + 0.007;
... |
c11172bd-16e1-4706-aa48-268e940f3d77 | 3 | public void appendSamples(int channel, float[] f)
{
int pos = bufferp[channel];
short s;
float fs;
for (int i=0; i<32;)
{
fs = f[i++];
fs = (fs>32767.0f ? 32767.0f
: (fs < -32767.0f ? -32767.0f : fs));
s = (short)fs;
buffer[pos] = s;
pos += channels;
}
buf... |
a9afa36f-c997-42fb-b7c7-0cd1b5a23294 | 1 | public boolean followUrl(final Url url) {
if (url == null) {
return false;
}
return url.link().startsWith(domain);
} |
b59b3929-bda5-4578-a518-51ccbe9cbb5d | 6 | public static void write(SelectionKey key) throws IOException {
loggerServer.info("WRITE: ");
SocketChannel socketChannel = (SocketChannel) key.channel();
ArrayList<byte[]> wbuf = null;
int offset;
int toWrite;
synchronized(key) {
wbuf = writeBuffers.get(key);
while (wbuf.size() > 0) {
byte[... |
a843dbd3-604b-4e3c-b0b6-b83869aa26f3 | 0 | public void init(FilterConfig fConfig) throws ServletException {
// TODO Auto-generated method stub
} |
5ca24d98-306a-4325-9efb-d00519784786 | 4 | public static int getLCM(int[] numArr) {
QuickSorter qc = new QuickSorter();
qc.sort(numArr);
int length = numArr.length;
int greatInt = numArr[length - 1];
int lcm = greatInt;
while(true) {
int count = 0;
for(int i:numArr) {
while(lcm%i != 0) {
lcm = lcm + greatInt;
count = 0;
}
... |
0d016a08-fe97-41b3-b747-0fde5009d19d | 6 | public static Stella_Object accessStringIteratorSlotValue(StringIterator self, Symbol slotname, Stella_Object value, boolean setvalueP) {
if (slotname == Stella.SYM_STELLA_THE_STRING) {
if (setvalueP) {
self.theString = ((StringWrapper)(value)).wrapperValue;
}
else {
value = String... |
ce0593ec-0488-4261-b285-673cc2520960 | 8 | public String[] getLine() throws IOException {
String[] ret = EMPTY_STRING_ARRAY;
record.clear();
while (true) {
reusableToken.reset();
nextToken(reusableToken);
switch (reusableToken.type) {
case TT_TOKEN:
record.add(reusab... |
52d02e1a-d729-45fc-a242-2373f40a1a66 | 2 | public Transition getTransitionByStateAndSymbol(String state, String symbol) throws Exception{
for(Transition tran: transitions){
if(tran.matchByStateAndSymbol(state, symbol, getSymbolByAlter(tran.getSymbolRef())))
return tran;
}
return null;
} |
03322f21-9e4d-4ea8-b989-98405f51fe70 | 5 | public void addFunc(Function f)
{
if(funcs.contains(f))
return;
funcs.add(f);
Field[] fields = f.getClass().getFields();
for(Field fi : fields)
{
if(Function.class.isAssignableFrom(fi.getType()))
{
Function f2 = nul... |
6daaa9a8-8186-491c-a7da-8cad68a06407 | 9 | public static UnitValue[] parseInsets(String s, boolean acceptPanel)
{
if (s.length() == 0 || s.equals("org.xito") || s.equals("panel")) {
if (acceptPanel == false)
throw new IllegalAccessError("Insets now allowed: " + s + "\n");
boolean isPanel = s.startsWith("p");
UnitValue[] ins = new UnitValue[4];
... |
dde507bf-9ae8-4715-8673-81c6015b3fbe | 7 | public synchronized void valueChanged(TreeSelectionEvent e) {
if (decompileThread != null)
return;
TreePath path = e.getNewLeadSelectionPath();
if (path == null)
return;
Object node = path.getLastPathComponent();
if (node != null) {
if (hierarchyTree && hierModel.isValidClass(node))
lastClassName... |
30f157fd-e395-4764-9b3d-14146a5a4faa | 4 | public static boolean mysqlExists(String query)
{
ResultSet result = null;
try {
result = MySQLCore.executeQuery(query, false);
} catch (SQLException e) {
e.printStackTrace();
}
try
{
if ((result != null) && (result.next()))
return true;
}
catch (SQL... |
0bf6c868-7b99-4b06-8fb8-81cc23a98be8 | 3 | public void encryptFile(String filePath, byte[][][] subKeys) {
System.out.println();
System.out.println("Encrypting Async");
try {
final File inputFile = new File(filePath);
final File outputFile = new File(filePath + ".des");
final InputStream inputStream = ... |
becd2b2a-332e-40c5-baf9-ccabae7717bc | 2 | public void supprimerTout() {
EntityManager em = getEntityManager();
boolean gereTransaction = !em.getTransaction().isActive();
if (gereTransaction)
em.getTransaction().begin();
em.clear();
if (gereTransaction)
em.getTransaction().commit();
} |
42ab7eaa-89c4-4a61-8d0b-53af67bc00dc | 8 | public void execute() throws MojoExecutionException
{
String currentFile = null;
InputStream is = null;
try
{
if (!outputDirectory.exists())
{
getLog().info("Create output directory: " + outputDirectory);
outputDirectory.mkdirs(... |
e92ee10f-9e02-4257-a2af-84836f1bb5ff | 2 | public UsuarioBean loadId(UsuarioBean oUsuario) throws ServletException {
try {
if (request.getParameter("id") != null) {
oUsuario.setId(Integer.parseInt(request.getParameter("id")));
} else {
oUsuario.setId(0);
}
} catch (NumberFormatEx... |
d0087615-1020-4bad-bfa1-a569560fb691 | 9 | public void process(String a, String b) {
char[] input = a.toCharArray();
char[] pat = b.toCharArray();
int[] shouldFind = new int[256];
int[] hasFound = new int[256];
for (int i = 0; i < pat.length; i++)
shouldFind[pat[i]]++;
Comparison.PRINT(shouldFind);
int l = 0;
int diff = 0;
char c;
int all... |
865cd611-6154-44b0-8d5b-a971c153976d | 4 | public void performAction() {
if (isConnected()) {
boolean first = getOutput()[0].getStatus();
if (this.isTurnedOn()) {
getOutput()[0].setStatus(!getInput()[0].getStatus());
}
else {
getOutput()[0].setStatus(false);
}
boolean second = getOut... |
d3c88dce-2ccb-4ac8-aae9-6c19da03d1d0 | 7 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
int key = parseInt(request.getParameter("key"));
int idServ = parseInt(request.getParameter("idServ"));
int idMed = parseInt(request.getParameter("idMed"));
int idCita = parseInt(request.get... |
a2828ff2-7b79-46e7-9ec2-4c8f99f1a937 | 5 | public void flagDates() {
try {
Date[] flagDates = DateManager.getDateRange(monthView.getFirstDisplayedDay(), monthView.getLastDisplayedDay());
List<Date> dateList = new ArrayList<Date>(Arrays.asList(flagDates));
Day dayCheckingBean;
boolean jobsExist = false;
Date dateToCheck = new Date();
int i = ... |
c88d2264-ecf0-4f2c-bce5-cd3fefca564d | 9 | public static void main(String[] args)
throws IOException
{
String host = args[0];
int port = Integer.parseInt(args[1]);
String serviceName = args[2];
BufferedReader in = null;
try{
in = new BufferedReader(new FileReader(args[3]));
}catch(FileNotFoundException e){
System.out.println("file "+args[3... |
1b81bc1c-c4b4-462d-b263-c2c31b659dc8 | 0 | public void setSource(Stack<IPaintable> a) {
actions = a;
} |
a2756a8a-1617-46e2-9556-f67f0715d354 | 8 | public static int[] merge(int[] list1, int[] list2) {
int[] mergedList = new int[list1.length + list2.length];
int length = list1.length + list2.length;
for ( int i = 0, j = 0, k = 0; i < list1.length && j < list2.length && k < length; i++, j++, k++) {
if (list1[i] < list2[j]) {
mergedList[k] = list1... |
aee6eb53-eb8a-4983-b7d0-f5b74313e876 | 4 | @Override
public boolean equals(Object obj)
{
boolean equals = false;
if (obj instanceof RgbDto)
{
RgbDto compareTo = (RgbDto) obj;
if (this.red == compareTo.getRed()
&& this.green == compareTo.getGreen()
&& this.blue == compareTo.g... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.