method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e0e4017e-157c-4dc2-9b98-84e939fc0b3a | 8 | public void addParamsFromFile(String fName){
BufferedReader bufread = null;
String curLine = null;
boolean done = false;
// First attempt to open and read the config file
try{
FileInputStream is = new FileInputStream(fName);
bufread = new BufferedReader(new InputStreamReader(is));
curLine = bu... |
26b9d8aa-53f6-4f1a-a62e-d5f6b644eb1e | 0 | @Override
public String getDesc() {
return "HammerFall";
} |
3bc23d57-e654-439d-ae1b-7b100ac0cf6c | 7 | @Override
public int castingQuality(MOB mob, Physical target)
{
if((mob!=null)&&(target!=null))
{
final Set<MOB> h=properTargets(mob,target,false);
if(h.size()<2)
return Ability.QUALITY_INDIFFERENT;
for(final MOB M : h)
if((M.rangeToTarget()<0)||(M.rangeToTarget()>0))
h.remove(M);
if(h.si... |
5f0d4115-75f1-40ec-b467-5b4551d8d846 | 5 | private MoveAndCost findBestMoveInternal(int[][] board, int allowedCallCnt) {
allowedCallCnt--; //this call
double minCost = Double.POSITIVE_INFINITY;
int[][] bestBoard = null;
Move bestMove = null;
int[][][] newBoards = getNewBoards(board);
int needCalls = getNeedCallsF... |
2474d2ef-c38b-40be-a4e7-8f02bf55b120 | 8 | public LinkedList getQuery(){
LinkedList result = new LinkedList();
if(!intervalBtns.isEmpty())
{
if(firstBtn == null)
{
System.out.println("Error: firstBtn is null but intervalBtns list is not empty. Check.");
}
else
{
/*
*
* If it's a groupInterval, add all its interval a... |
a37994fb-ef63-4613-b737-3cb427667a7f | 5 | public ArrayList<Integer> getShortestPaths(int src, GraphAPI gapi) {
ArrayList<Integer> shPaths = new ArrayList<Integer>();
for(int i=0; i<gapi.N; i++) {
if(i==src)
shPaths.add(0);
else
shPaths.add(INT_MAX_VAL);
}
// Loop over V-1 vertices
for(int i=0; i<gapi.N-i; i++) {
// Loop over all e... |
3050e490-8b72-4578-abd9-50eff20baf5d | 8 | public ClientUpdaterModContainer()
{
super(new ModMetadata());
ModMetadata meta = super.getMetadata();
meta.authorList = Arrays.asList(new String[] {"robin4002"});
meta.modId = "clientupdater";
meta.version = "1.7.2";
meta.name = "Client Updater";
meta.version = "@VERSION@";
if(FMLCommonHandler.instan... |
5161aeb8-9b0b-4d6f-af53-334a220ba233 | 7 | private void rotateLeft( final Node node ) {
final Node right = node.mRight;
if( right == null ) {
return;
}
node.mRight = right.mLeft;
if( node.mRight != null ) {
node.mRight.mParent = node;
}
right.mLeft = node;
if( node == mRo... |
a4e5a0c3-5973-4bbc-b3a8-aab4abc63f8e | 8 | static Object tryInstantiate(final Class<?> clazz) throws InstantiationException {
Class<?> cl = clazz;
while (cl != Object.class) {
if (!isProxy(cl)) {
try {
return cl.newInstance();
} catch (ReflectiveOperationException goNext) {}
}
cl = cl.getSuperclass();
}
... |
40fb8219-819e-4f5d-bf12-1edd836c9a23 | 5 | public static Time toTime(Object length) {
if (length != null && String.class.isAssignableFrom(length.getClass())) {
String text = (String) length;
if(text.matches("\\d{1,2}:\\d{1,2}:\\d{1,2}")){
return Time.valueOf(text);
}
else if(text.matches("... |
848f7220-4afc-4abb-bb25-2c2f26627332 | 7 | private void exerciseObjectList(List<ObjectTypes> list, long length) {
assertEquals(length, list.size());
gcPrintUsed();
ObjectTypes.A a = new ObjectTypes.A();
ObjectTypes.B b = new ObjectTypes.B();
ObjectTypes.C c = new ObjectTypes.C();
ObjectTypes.D d = new ObjectTypes.D();
long start = ... |
d850973a-5e3e-4548-937e-b395a9dc2458 | 3 | public void acceptConnection(Connection con){
if(connectionTimer!=null){
connectionTimer.cancel();
}
//stop broadcasting
if(bcast!=null && bcast.isRunning()){
bcast.stop();
}
waitingOnPassword = false;
client_connected = true;
conID = con.getID();
ServerMsg msg = new Serve... |
b38bd5fa-9965-471c-8366-4bc08b9ffe21 | 9 | public static void main(String[] args) {
BufferedReader input= new BufferedReader(new InputStreamReader(System.in));
boolean prima;
try{
System.out.print("Masukan batas bawah:");
int batas_bawah=Integer.parseInt(input.readLine());
System.out.print("Masukan bat... |
3fe11ee5-97ea-4d0a-bd38-c23d276afaa7 | 7 | public static void setZero(int[][] array){
boolean[] col = new boolean[array[0].length];
boolean[] row = new boolean[array.length];
for(int i=0;i<array.length;i++){
for(int j=0;j<array[0].length;j++){
if(array[i][j] == 0){
col[j] = true;
row[i] = true;
}
}
}
for(int i=0;i<array.length;... |
10d44217-a33c-4dfa-9cd7-4149f800179a | 5 | public void run() {
super.init(Properties.PORT);//initialize the RMI registry
while (running) {
// send a message to each resource manager, requesting its load
for (String rmUrl : resourceManagerLoad.keySet())
{
/*
* TODO This part needs to be changed from localsocket to using RMI
*/
... |
01201e72-6ded-436f-8b2c-f5e3627b6c87 | 9 | public void clearRows() {
boolean [] notFullRows = new boolean[board.length];
for (int r = board.length - 1; r >= 0; r--) {
for (int c = 0; c < board[r].length && !notFullRows[r]; c++) {
if (board[r][c] == EMPTY)
notFullRows[r] = true;
}
}
boolean temp = false;
for (boolean b : notFullRows)... |
0b9d8752-70b6-49dc-95b4-5a072a8a890e | 5 | public int compareTo(Duration other) {
if (other == null) {
throw new NullPointerException("Cannot compare Duration to null.");
}
if (this.millis == other.millis) {
return nanos < other.nanos ? -1 : nanos == other.nanos ? 0 : 1;
}
return this.millis < othe... |
d0a1fa6c-19e7-44fb-9052-aeb217bbb9e3 | 0 | @Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Long getId() {
return id;
} |
08052eea-d0a0-42ad-8f8b-0dac7b0bb960 | 4 | public void createHexagons(int hexagonColumns, int hexagonRows, int r, int x, int y){
int originalX = x;
for(int j=0; j<hexagonRows; j++){
for(int i=0; i<hexagonColumns; i++){
singleHexagon = new Polygon();
for(int k=0; k<6; k++) {
singl... |
ee2368d7-3fd5-4a3d-9742-aed135cc632c | 0 | private void initUpperBars(){
upperBars = new JPanel();
upperBars.setLayout(new BorderLayout());
upperBars.add(menuBar, BorderLayout.NORTH);
upperBars.add(menuBarWithButtons, BorderLayout.SOUTH);
add(upperBars, BorderLayout.NORTH);
} |
eea07f58-d0ba-4c0d-a893-5f844a8bbafe | 5 | public void setTypeNumber() {
if (type == Type.AIR) typeNumber = 0;
if (type == Type.DIRT) typeNumber = 1;
if (type == Type.WOOD) typeNumber = 2;
if (type == Type.STONE) typeNumber = 3;
if (type == Type.GLASS) typeNumber = 4;
} |
5032ac7a-1102-4784-9df5-af85fa9fd518 | 4 | public Color[] fileToColorArray(File file) throws IOException {
int lim;
File2Hex converter = new File2Hex();
String hexString = converter.convertToHex(file);
Scanner hexStringScanner = new Scanner(hexString);
ArrayList<String> snipArray = new ArrayList<>();
while(hexSt... |
7813c7bf-92d7-4dba-a5fd-4ae9acdf347a | 2 | public void deposit (int amount)
{
org.omg.CORBA.portable.InputStream $in = null;
try {
org.omg.CORBA.portable.OutputStream $out = _request ("deposit", true);
$out.write_ulong (amount);
$in = _invoke ($out);
return;
} ... |
2d4bcc1c-7043-4c12-a162-ba3f7e14e94b | 9 | /* */ public String attemptingToConnect(String username, char[] password)
/* */ {
/* 76 */ Config.USERNAME = username.toLowerCase();
/* 77 */ String serverResponse = null;
/* */
/* 80 */ Player player = new Player(0, -1, username, 0, 193, 423, "cache/graphics/sprites/character.png", null... |
ab254b4c-ea65-4aae-b9ae-b2b229b4b2b7 | 1 | public void updateSubTypes() {
if (!staticFlag)
subExpressions[0].setType(Type.tSubType(classType));
} |
30b8e0cd-786a-4022-a4c5-5e5c5d9a1930 | 2 | private TreeRow getBeforeFirstSelectedRow() {
TreeRow prior = null;
for (TreeRow row : new TreeRowViewIterator(this, mRoot.getChildren())) {
if (mSelectedRows.contains(row)) {
return prior;
}
prior = row;
}
return null;
} |
7bf809a0-4741-4f65-b9c7-fe95fdfbf1e0 | 5 | public static void loadOtherTabAccount(String serverID) {
Account account = null;
for (int i = 0; i < Account.allAccounts.length; i++) {
try {
if (!"OpenTransactionAccount".equals(Account.allAccounts[i]) && !"CashPurseAccount".equals(Account.allAccounts[i])) {
... |
c3b7ba4b-9523-4641-b2f6-1239bcf7e36b | 7 | @Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
super.executeMsg(myHost,msg);
if((affected!=null)
&&(affected instanceof MOB)
&&(msg.amISource((MOB)affected)||msg.amISource(((MOB)affected).amFollowing())||(msg.source()==invoker()))
&&(msg.sourceMinor()==CMMsg.TYP_QUIT))
{
... |
dcdf2bc1-3ced-451a-a821-8b9ecd5c8b9c | 0 | public RSAKeyValueType createRSAKeyValueType() {
return new RSAKeyValueType();
} |
a92adf18-30b3-46fd-9014-01187c082446 | 4 | private void LoadFriends() throws SQLException
{
Grizzly.GrabDatabase().SetQuery("SELECT * FROM server_friendships WHERE user_id = '" + this.ID + "'");
if (Grizzly.GrabDatabase().RowCount() > 0)
{
ResultSet AsFirstFriend = Grizzly.GrabDatabase().GrabTable();
while(AsFirstFriend.next())
{
Fri... |
1cb28fb8-76ff-4ffc-a2bc-3e83eb13db96 | 3 | public void die(){
if (sound.Manager.enabled) {
sound.Event effect = new sound.Event(getPosition(), getVelocity(),sound.Library.findByName(DEATH_EFFECT));
effect.gain = EFFECT_VOLUME;
sound.Manager.addEvent(effect);
}
velocity.timesEquals(0);
if(Parti... |
e7a7fec2-270b-4446-811e-f30ced1c5706 | 2 | private int getDistanceBetweenTiles(Tile from, Tile to) {
int distance = 14;
if (from.getX() == to.getX()) {
distance = 10;
}
if (from.getY() == to.getY()) {
distance = 10;
}
return distance;
} |
014365fc-fda2-4f51-9980-8feffddc72bb | 6 | protected void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
HttpSession session = req.getSession(true);
String url = "/";
String action = (String)req.getParameter("action");
LoginViewHelper loginViewHelper =
ViewHelperFactory.getInstance().g... |
99e2adab-87e2-4412-8dd2-401ce4e8ce39 | 2 | public static int createMenu(Menu menu, String accessToken) {
int result = 0;
// ƴװ˵url
String url = menu_create_url.replace("ACCESS_TOKEN", accessToken);
// ˵תjsonַ
String jsonMenu = JSONObject.fromObject(menu).toString();
// ýӿڴ˵
JSONObject jsonObject = httpRequest(url, "POST", jsonMenu);
if (null !... |
3e89a3f7-d637-4bd5-a943-15aa85f5a809 | 8 | public void loadConfiguration() throws ParserConfigurationException, SAXException, IOException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = factory.newDocumentBuilder();
Document doc = docBuilder.parse(configurationFile);
// Get th... |
a1c500d4-3d4f-4fa8-8df6-a7fb3e8ece37 | 4 | public void testBinaryCycAccess2() {
System.out.println("\n**** testBinaryCycAccess 2 ****");
CycAccess cycAccess = null;
try {
try {
if (connectionMode == LOCAL_CYC_CONNECTION) {
cycAccess = new CycAccess(testHostName, testBasePort);
} else if (connectionMode == SOAP_CYC_CO... |
20b35737-0628-4f79-a5be-c6cb715b0f1b | 8 | public void ShowHelp(CommandSender sender, String cmdLabel, int page) {
ArrayList<String> cmds = new ArrayList<String>();
cmds.add("/" + cmdLabel + " help " + prekick.language.GetText("PreKickCommand.Help.Help").replaceAll("%CMDLABEL%", cmdLabel));
if (p(sender, "prekick.blacklist.switch"))
cmds.add("/" + cm... |
039958d5-b67d-431e-9896-faf48e2c15c7 | 0 | public void setLastActivity(int lastActivity) {
this.lastActivity = lastActivity;
} |
dde0773a-ad5d-46cc-9802-fc6fe51029c4 | 1 | private void createPlayHistory(int drawnCard){
DataInstance pdi = new DataInstance(playNet.inputNodes());
//Rack
int[] cur_rack = rack.getCards();
pdi.addFeature(cur_rack, game.card_count);
//Probabilities
if (USE_PROB_PLAY){
double[][] prob = rack.getProbabilities(false, 0);
pdi.addFeature(prob[0], 1... |
50ccb333-93a1-4773-8f8a-6d364aaffcfe | 5 | public boolean setNewValue(int depth, int value) {
if(isFull()) {
return false;
}
if(depth==1) {
if(o0==null) {
set0(new HuffmanNode(this, value));
return true;
}
else if(o1==null) {
set1(new HuffmanNode(this, value));
... |
7b0ab5b1-4c41-4d47-9ca9-3cf3d054c12e | 4 | private Vector<String> getAvailableLF()
{
final LookAndFeelInfo lfs[] = UIManager.getInstalledLookAndFeels();
lookNFeelHashMap = new HashMap<>(lfs.length);
final Vector<String> v = new Vector<>(lfs.length);
for (final LookAndFeelInfo lf2: lfs)
{
lookNFeelHashMap.put(lf2.getName(), lf2.getClassName());... |
1d901aca-977e-4458-9a8a-2c5eb1bc924c | 7 | protected void execute(final String action) throws MojoExecutionException, MojoFailureException {
final Properties properties;
try {
properties = PropertiesUtil.getInstance().loadProperties(propertiesPath);
} catch (IOException e) {
throw new MojoFailureException("Could n... |
fffd89a3-003a-485c-9b04-0fa7fd834be0 | 2 | public void solve() {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int res = 0;
for (int i = 1; i <= n; i++) {
if (gcd(i, n) == 1) {
res++;
}
}
System.out.println(res);
} |
e33da5f0-5c89-4bff-b8d4-5a5ada1f446c | 2 | public static void main (String[] args) {
int[] a = new int[14];
int[] b = new int[4];
for (int i=0; i !=4 ; i++) {
a[i] = i * i;
}
for ( int i=0; i != b.length; ++i ) {
b[i] = i * 2;
}
mergeB2A(a, b, 4, b.length);
System.out.println( Arrays.toString(a) );
} |
1e187a64-4602-4523-a9af-50ba28122b05 | 2 | public void loadChannels() throws SQLException {
sql.initialise();
ResultSet res = sql.sqlQuery("SELECT * FROM BungeeChannels");
while(res.next()){
ChatChannel newchan = new ChatChannel(res.getString("ChannelName"), res.getString("ChannelFormat"),res.getString("Owner"), res.getBoolean("isServerChannel"));
p... |
3f9bc699-f620-449c-a0e8-07405012c1dd | 6 | private static void applyHysteresis(Image image, double t1, double t2,
ChannelType c) {
ChannelType color = c == null ? RED : c;
for (int x = 0; x < image.getWidth(); x++) {
for (int y = 0; y < image.getHeight(); y++) {
double pixel = image.getPixel(x, y, color);
double val = pixel;
if (pixel < t1... |
7c03b85c-a9ff-4b1e-85bf-e00ff68f9091 | 2 | public int[][] getActualGrid()
{
int[][] gridActual = new int[sudokuSize][sudokuSize];
for (int i = 0; i < sudokuSize; i++) {
for (int j = 0; j < sudokuSize; j++) {
gridActual[i][j] = cells[i][j].current;
}
}
return gridActual;
} |
4f432ef6-3670-4297-adbd-9221b43ed102 | 5 | @Override
public void controllAnts(LinkedList<MyAnt> freeAnts, long time) {
for (MyAnt ant : freeAnts) {
Logger.printLine(ant + " tries to survive");
LinkedList<Field> neighbors = new LinkedList<Field>();
for (Field neighbor : ant.getField().getTurnNeighbors()) {
if (!neighbor.hasWater())
neighbors... |
0c0fc0b5-ca55-4733-9d42-7976dc829f06 | 7 | public boolean collidesRectAgainstRect(double x1, double y1, int width1, int height1, double x2, double y2,
int width2, int height2) {
double right1 = x1 + width1;
double right2 = x2 + width2;
double bottom1 = y1 + height1;
double bottom2 = y2 + height2;
return (x1 <= x2 && x2 < right1 || x2 <= x1 && x1 <... |
ea196fa1-c330-47aa-b8c6-47f9f21cb624 | 2 | public ArrayList<Employee> searchEmployee(String name) {
ArrayList<Employee> _searchResults = new ArrayList<Employee>();
for (Employee emp : employees)
{
if(emp.getFullName().contains(name)) {
_searchResults.add(emp);
}
}
return _searchResults;
} |
4af6f30b-ece5-487b-9629-25480df17d94 | 5 | private void btnCadastrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCadastrarActionPerformed
//Tela de Cadastro de Departamento
if (txtNomeDep.getText().equals("") || txtCodDep.getText().equals("")) {
JOptionPane.showMessageDialog(null, " Preencha todos os campos... |
66ede95b-ad81-44c9-b02a-df6df55916f9 | 9 | public static Direction findDirection(Point source, Point dest)
{
if(source.equals(dest))
return null;
long p = source.getX();
long q = source.getY();
long r = dest.getX();
long s = dest.getY();
if(p<r && q>s)
return Direction.SOUTHEAST;
else i... |
bcd16057-15d7-46aa-b59b-748f272895f0 | 2 | private int[] hideLay(int[][] lay) {
int hiddenLay[] = new int[HEIGHT * HEIGHT];
int k = 0;
for (int i = 0; i < HEIGHT; i++) {
for (int j = 0; j < HEIGHT; j++) {
hiddenLay[k++] = lay[i][j];
}
}
return hiddenLay;
} |
50441a68-f505-42ec-825e-5dd1fef911b2 | 6 | public void tableChanged(TableModelEvent e) {
// If we're not sorting by anything, just pass the event along.
if (!isSorting()) {
clearSortingState();
fireTableChanged(e);
return;
}
// If the ta... |
f347d238-6275-49c2-a865-09953529c142 | 7 | @Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
super.executeMsg(myHost,msg);
if((myHost==null)||(!(myHost instanceof MOB)))
return;
final MOB mob=(MOB)myHost;
if(msg.amISource(mob)&&(msg.tool() instanceof Ability))
{
final Ability A=(Ability)msg.tool();
if((mob.is... |
f204179e-3e8c-4a7c-a40b-4cd1f50c3257 | 9 | public static void main(String[] args) throws InterruptedException{
int iloscProcesowA = 3;
int iloscProcesowB = 3;
int iloscProcesowAB = 3;
Thread procesyA[] = new Thread[iloscProcesowA];
Thread procesyB[] = new Thread[iloscProcesowB];
Thread procesyAB[] = new Thread[iloscProcesowAB];
Zasoby z... |
9bbb0350-6f09-49c0-973c-f1387c7a19ff | 3 | private void repaintChangedRollRow(Row rollRow) {
if (rollRow != mRollRow) {
Column column = mModel.getColumnAtIndex(0);
Rectangle bounds;
if (mRollRow != null) {
bounds = getCellBounds(mRollRow, column);
bounds.width = mModel.getIndentWidth(mRollRow, column);
repaint(bounds);
}
if (rollRo... |
f8188f3c-90fe-444a-9443-650a7c78399a | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PhpposSalesItemsEntityPK that = (PhpposSalesItemsEntityPK) o;
if (itemId != that.itemId) return false;
if (saleId != that.saleId) return false;... |
125ae831-078c-4f93-91c0-a84773893e60 | 7 | private static double calculatePeptideMass(AminoAcidSequence aminoAcidSequence,
List<PTModification> modifications,
boolean monoMass,
double... massCorrections) {
// calcu... |
1960f7da-cdfd-419e-80dc-fd2673909fcb | 8 | public byte[] getNetworkBytes() {
ByteArrayOutputStream buf = new ByteArrayOutputStream();
buf.write((byte) 0x23);
buf.write((byte) 0x54);
buf.write((byte) 0x26);
buf.write((byte) 0x68);
for (int i = 7; i >= 0; i--) {
buf.write((byte) ((tstamp >> 8*i) & 0xff));
}
for (BLImageViewport viewpor... |
2f9b0874-5bef-4df9-8c4b-92a236e13c60 | 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... |
1328acc7-a45d-49e5-a861-519963a8abee | 9 | public Counter winningMove(Move lastMove, Board b) {
boolean end = false;
int x = Board.MINWIDTH;
int y = b.getHeight();
Counter winner = Counter.EMPTY;
while((y >= Board.MINHEIGHT) && !end) {
while ((x <= b.getWidth() && !end)) {
//Check up
end = Util.checkCellInDirection(b, x, y, DirectionX.NO... |
594e21e1-e6bb-450c-926e-d544988d29a2 | 5 | public void endEditingTurn()
{
if(myTurnEditing) //finish with player 1
{
if(Main.isTwoPlayers)
{
myTurnEditing = false;
mySea.renderEditingShip = false;
theirSea.renderEditingShip = true;
editingPos = -1;
editNextShip();
Main.manualAdding = true;
Main.editingMode = true;
Ma... |
b66bc972-83cd-4e52-b219-6f0518406a67 | 7 | protected boolean stepSearch() {
if (maxSearched > 0 && flagged.size() > maxSearched) {
if (verbose) I.say("Reached maximum search size ("+maxSearched+")") ;
return false ;
}
final Object nextRef = agenda.leastRef() ;
final T next = agenda.refValue(nextRef) ;
agenda.deleteRef(nextRef) ;
... |
8b827aca-0de5-49bb-8553-a2a9be7f6802 | 3 | private Status testForTrack(int x, int y, int z) {
World world = tile.getWorldObj();
for (int jj = -2; jj < 4; jj++) {
if (!world.blockExists(x, y - jj, z))
return Status.UNKNOWN;
if (RailTools.isRailBlockAt(world, x, y - jj, z)) {
trackLocation = ... |
ffd4e28c-8392-40f2-aa5d-1dee1858c252 | 7 | public void objectGroundCollision()
{
long time = System.currentTimeMillis();
if (gcontact==null) gcontact = new Contact(new Vector(), new Vector(), 0);
for (ObjectProperties object : scene.getObjects())
{
if (!object.isPinned && scene.getCount() > 0 && object !... |
899cf0c7-300d-4e91-b596-f60c0177edd5 | 3 | public byte[] decoding(byte[] data) {
int bufLen = data.length - (data.length + 31) / 32 * 2;
ByteBuffer buf = ByteBuffer.allocate(bufLen);
ByteBuffer inDataBuf = ByteBuffer.wrap(data);
for(int i = 0; i != data.length / 2; i++) {
if(i % 16 == 15 || i == data.length / 2 - 1) ... |
9bc2e8c3-f3ba-4623-a7f8-5c5f5fcbb9c7 | 6 | @Override
public final String generateHtmlCode() {
final StringBuilder sb = new StringBuilder();
sb.append("<!-- TableHelper Generated Code -->\n");
sb.append("<table>\n");
if (this.headersTopRow != null) {
sb.append("\t<tr>\n");
if (this.headersLeftRow != null) {
sb.append("\t\t<th> </... |
3e2f7521-2796-4243-81fa-3ecea5d3ae82 | 1 | @SuppressWarnings("deprecation")
public void testConstructor_RP_RP_PeriodType4() throws Throwable {
YearMonthDay dt1 = new YearMonthDay(2005, 7, 17);
YearMonthDay dt2 = null;
try {
new Period(dt1, dt2);
fail();
} catch (IllegalArgumentException ex) {}
} |
b579ea54-4561-49f9-905e-4a0835c3554d | 1 | public List<Punto> ObtenerPunto(String consulta){
List<Punto> lista=new ArrayList<Punto>();
if (!consulta.equals("")) {
lista=cx.getObjects(consulta);
}else {
lista=null;
}
return lista;
} |
de33c096-9a9c-4728-924f-9931379fa1f4 | 3 | public void validatePassword(ComponentSystemEvent event)
{
UIComponent components = event.getComponent();
UIInput uiInputPassword = (UIInput) components
.findComponent("password");
password = uiInputPassword.getLocalValue() == null ? ""
: uiInputPassw... |
69b2df7b-f215-4bf7-a383-fb29ce3e1fd8 | 0 | public String getTableName() {
return tableName;
} |
d7986fee-411a-4381-a4e2-6f4045e91b36 | 8 | public static void fillHex(int i, int j, double wi, double hi, String n, int xWorm, int yWorm, Graphics2D g2) {
int xFrom, yFrom;
int xTo = (int) ((i * (s + t)) + s + BORDERS);
int yTo = (int) ((j * h + (i % 2) * h / 2) + r + BORDERS);
int x = i * (s + t);
int y = j * h + (i % 2)... |
7f7784ab-c3e7-428a-8a1a-59fb9cbec71d | 1 | private static void output (ArrayList <String> pseudographics){
for (String e : pseudographics){
System.out.println(e);
}
} |
b4353dc4-4eea-43ad-a17f-e4774e873901 | 3 | public static Object load(String path){
if(! new File(path).exists()){
return null;
}
Object object = null;
try {
FileInputStream fis = new FileInputStream(path);
ObjectInputStream ois = new ObjectInputStream(fis);
try{
... |
0c60bcec-92c7-4f5d-8397-38188b1a066b | 9 | private void readTrunks(File pngFile) throws IOException {
DataInputStream input = new DataInputStream(new FileInputStream(pngFile));
try {
byte[] nPNGHeader = new byte[8];
input.readFully(nPNGHeader);
trunks = new ArrayList<PNGTrunk>();
if ((nPNGHeader[0] == -119) && (nPNGHeader[1] == 0x50)
&& (n... |
3a1412ed-38bc-499c-b9a7-23f22b1ae0de | 8 | public static int convertType(String type) throws Exception {
int t = 0;
if (SESSION_TRANSACTED.equals(type) || String.valueOf(Session.SESSION_TRANSACTED).equals(type)) {
t = Session.SESSION_TRANSACTED;
}
else if (CLIENT_ACKNOWLEDGE.equals(type) || String.valueOf(Session.CLIENT_ACKNOWLEDGE).equals(type)) {
... |
5353bc8d-a4d4-4903-9a93-89af0aba3954 | 6 | public static void main(String[] args) {
CL.setExceptionsEnabled(true);
int numPlatformsArray[] =new int[1];
int buffersize=0;
int n=1024*1024*10;
float srcArrayA[] = new float[n];
float srcArrayB[] = new float[n];
float dstArray[] = new float[n];
for (int i=0; i<n; i++)
{
... |
950f922e-11d8-4a66-87ca-a07c3b46b9b4 | 4 | public void getEnvironmentExits () {
ResultSet rs = Main.mysql.getData("SELECT * FROM `environments_exits`");
try {
while (true) {
String[] tempString = new String[6];
tempString[0] = rs.getString(2); // Name
tempString[1] = rs.getString(3); //... |
99473351-4b85-4c55-9ed4-b8676a3bd567 | 8 | public final int partitionByBarCode(int left, int right) // see the name version of this method
{
Product pivotElement = products[left];
int max = logicalSize;
int lb = left, ub = right;
Product temp;
while (left < right)
{
while((products[left].getBarCode() <= pivotElement.getBarCode()) && left +1 < ... |
d89fe708-7982-415a-89a9-09deade9d794 | 3 | private int ssMedian3 (final int Td, final int PA, int v1, int v2, int v3) {
final int[] SA = this.SA;
final byte[] T = this.T;
int T_v1 = T[Td + SA[PA + SA[v1]]] & 0xff;
int T_v2 = T[Td + SA[PA + SA[v2]]] & 0xff;
int T_v3 = T[Td + SA[PA + SA[v3]]] & 0xff;
if (T_v1 > T_v2) {
final int temp = v1;
v1... |
214bf01f-d60a-4878-bc27-6be3909c2ef6 | 0 | @Test
public void findDuplicateTypeHand_whenThreePairsExist_returnsHighestTwoPair() {
Hand hand = findDuplicateTypeHand(twoKingsTwoQueensTwoJacksSix());
assertEquals(HandRank.TwoPair, hand.handRank);
assertEquals(Rank.King, hand.ranks.get(0));
assertEquals(Rank.Queen, hand.ranks.get(1));
assertEquals(Rank.Ja... |
11af33d9-5033-46e6-879e-43a9b60a1c7d | 6 | public static void staticExportSets() {
HashSet<ItemSet> setnames = new HashSet<>();
for (Shoes s : shoes) {
setnames.add(s.getItemset());
}
for (Pants s : pants) {
setnames.add(s.getItemset());
}
for (Gloves s : gloves) {
setnames.add(s.getItemset());
}
for (Armor s : armors) {
setnames.ad... |
70b6f87d-b2cd-445c-89f9-a0619316573d | 2 | public void replace(int depth, final Expr expr) {
for (int i = stack.size() - 1; i >= 0; i--) {
final Expr top = (Expr) stack.get(i);
if (depth == 0) {
stack.set(i, expr);
return;
}
depth -= top.type().stackHeight();
}
throw new IllegalArgumentException("Can't replace below stack bottom.");... |
973a0f78-a266-44e5-a65b-ea783cb1d686 | 0 | public SimpleStringProperty countryCodeProperty() {
return countryCode;
} |
9ef7aeb4-2e23-4f0a-a3ea-23df72b941e1 | 5 | @Override
public boolean onMouseDown(int mX, int mY, int button) {
if(button == 0 && mX > x && mX < x + width && mY > y && mY < y + height) {
Application.get().getHumanView().popScreen();
return true;
}
return false;
} |
f7d7d3db-f784-4bfc-89f0-4e33b7c54e4e | 7 | @RequestMapping(value = "/ay", method = RequestMethod.POST, params = "refresh")
public String salvestaAyl(@Valid @ModelAttribute("ayw") ayView ayw, // BindingResult
// result,
ModelMap model) {
System.out.println("kas siia ays POST jouab");
String liik_ID = ayw.getCurrent().getLiik_i... |
99f76fb3-b213-484c-b7f4-6ad39555c4b8 | 3 | public boolean isWarningStopCodon() {
if (!Config.get().isTreatAllAsProteinCoding() && !isProteinCoding()) return false;
// Not even one codon in this protein? Error
String cds = cds();
if (cds.length() < 3) return true;
String codon = cds.substring(cds.length() - 3);
return !codonTable().isStop(codon);
... |
eb832f33-f2a8-4515-b3ad-58107f78d630 | 0 | public void setId(Long id) {
this.id = id;
} |
51da66ce-b384-48c4-bc0f-1de888e20cd1 | 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... |
5f7754ba-8aa6-4861-8201-3af00cb8fe27 | 9 | public org.apache.xalan.templates.ElemVariable getElemVariable()
{
// Get the current ElemTemplateElement, and then walk backwards in
// document order, searching
// for an xsl:param element or xsl:variable element that matches our
// qname. If we reach the top level, use the StylesheetRoot's ... |
76edbedd-ab29-4bc4-becf-660aaeac21ad | 7 | public void checkConsistent() {
StructuredBlock[] subs = getSubBlocks();
for (int i = 0; i < subs.length; i++) {
if (subs[i].outer != this || subs[i].flowBlock != flowBlock) {
throw new AssertError("Inconsistency");
}
subs[i].checkConsistent();
}
if (jump != null && jump.destination != null) {
J... |
ebb13432-9b2d-41f1-9d81-d13671c5d007 | 5 | static boolean multipliable(AlgebraicParticle a, AlgebraicParticle b){
return a.getClass().equals(b.getClass()) && a.almostEquals(b)
//mixed number need to be converted to fractions first
|| Util.constant(a) && Util.constant(b) && !(a instanceof MixedNumber) && !(b instanceof MixedNumber);
} |
82ec9edf-fa83-43ab-a894-325fce35d8a3 | 9 | private void paintBlock(Graphics2D g2d, ThreesBlock block){
int blockWidth = MAX_WIDTH/4;
int blockHeight = MAX_HEIGHT/4;
// Image redTwoImage = Toolkit.getDefaultToolkit().getImage(Panel.class.getResource("E:\\javaProject\\Threes\\src\\threes\\2.png"));
// Image blueOneImage = new Image... |
45c0fa09-bec7-48a1-ba05-95014b8d34d7 | 1 | public static String toString(long[] message) {
StringBuilder out = new StringBuilder();
for (int i = 0; i < message.length; i++) {
out.append(message[i]);
out.append(' ');
}
return out.toString();
} |
e9d63394-8863-48c0-a3ca-bc376f26090b | 4 | protected float transmitChance(Actor has, Actor near) {
//
//
if (! near.health.organic()) return 0 ;
if (has.species() != near.species()) return 0 ;
if (near.traits.traitLevel(this) != 0) return 0 ;
if (near.traits.test(VIGOUR, virulence / 2, 0.1f)) return 0 ;
//
// TODO: THERE HAS ... |
a91c7bf5-3387-4bb1-b3a3-bf318f82ec5a | 0 | private void Order(ArrayList<Company> companies) {
Collections.sort(Companies, new Comparator<Company>() {
@Override
public int compare(Company p1, Company p2) {
return new String(p1.getName()).compareTo(p2.getName());
}
});
} |
0f6aab10-5fe8-4dc7-a89b-3fe937676765 | 4 | public int _setValue(int key,String valueName, String value) throws RegistryErrorException
{
try
{
Integer ret = (Integer)setValue.invoke(null, new Object[] {new Integer(key), getString(valueName), getString(value)});
if(ret != null)
return ret.intValue();
else
return -1;
... |
34c8e5eb-fa4c-47d5-8613-d20c7c0a05f4 | 1 | public void removeAllOutgoingTransitions() {
for(Transition t:outgoingTransitions) {
t.getToState().removeIncomingTransition(t);
}
outgoingTransitions = new ArrayList<Transition>();
} |
90b002bf-51d4-4850-a893-341a06042ffa | 9 | public Set<Element> calcFermeture() {
List<Item> generators = new ArrayList<Item>();//Liste des générateurs
List<Double> support = new ArrayList<Double>();//Liste des supports
List<Set<Item>> fermeture = new ArrayList<Set<Item>>();//Liste des fermetures
Set<Element> retTable = new HashSet<Element>(); //Table à ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.