method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
426af2dc-0e76-4999-8852-3fac0e36f486 | 8 | private double[][] calAvailability(double[][] rmatrix) {
double[][] amatrix = new double[dNum][dNum];
for (int i = 0; i < dNum; i++) {
for (int k = 0; k < dNum; k++) {
//首先计算max(0,R(j,k))对于j的求和,其中j!=i且j!=k
double maxSum = 0;
for (int j = 0; j <... |
009b1756-8011-4933-aff6-b23328cc49d7 | 1 | @SuppressWarnings("deprecation")
public void testCompareTo() {
LocalTime test1 = new LocalTime(10, 20, 30, 40);
LocalTime test1a = new LocalTime(10, 20, 30, 40);
assertEquals(0, test1.compareTo(test1a));
assertEquals(0, test1a.compareTo(test1));
assertEquals(0, test1.compareT... |
b9f61935-cf43-4c3a-a9b9-2afae23e7968 | 7 | public String[][] getJSON(){
@SuppressWarnings("unchecked")
ArrayList<String>[] temp = new ArrayList[5];
for (int i = 0; i < temp.length; i++){
temp[i] = new ArrayList<String>();
}
for (AirNowDataSite site : dataSites){
for (AirNowDataPoint[] dataArray : site.getDataPoints()){
temp[0].add(site.getId... |
d10e4af8-2245-408d-9b65-118fdeddd4ce | 6 | boolean endGoalEmpty(int col){
if (col == Chip.WHITE) {
for (int i = 1; i<7; i++) {
if(board[7][i].returnColor() == Chip.WHITE)
return false;
}
}
if (col == Chip.BLACK) {
for (int i = 1; i<7; i++) {
if(board[i][7].returnColor() == Chip.BLACK)
return fals... |
f215eb00-4f70-4c5f-84c6-7a98b14d156d | 6 | private void movement(double delta) {
if (y <= 0)
vy = speed;
if (y >= sp.getHeight() - height)
vy = -speed;
if (x <= 0) { // If hits left side (Player)
vx = speed;
sp.aiScore++;
}
if (x >= sp.getWidth() - width) { // If hits right side (AI)
vx = -speed;
sp.p1Score++;
}
x += vx * delta;... |
a3affcc7-6efb-41c4-9ccb-08a2eb7ef9db | 9 | public static boolean processISmega(final MapleClient c, final IItem item, final String msg, final boolean ear) {
String message = msg.toLowerCase();
if (msg.length() > 100) {
c.showMessage("[Anbu] toobad so sad. not over 100 characters. :P");
c.getSession().write(MaplePacketCrea... |
ce68bcdf-81ca-4118-8294-39c2f54e7264 | 9 | public boolean isBoundingBoxBurning(AxisAlignedBB par1AxisAlignedBB)
{
int var2 = MathHelper.floor_double(par1AxisAlignedBB.minX);
int var3 = MathHelper.floor_double(par1AxisAlignedBB.maxX + 1.0D);
int var4 = MathHelper.floor_double(par1AxisAlignedBB.minY);
int var5 = MathHelper.floo... |
9ca259ad-8ea5-42ae-8a2d-65dfd86bd326 | 0 | public CheckResultMessage checkTF04(int day) {
return checkReport.checkTF04(day);
} |
6a6910f2-52f3-4ba7-8966-9b22c9842d4d | 3 | public void addDialPanel(final String remoteChannel, final String localChannel){
if(remoteChannel!=null&&localChannel!=null){
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
String remoteNumber = remoteChannel.substring(0,remoteChannel.indexOf("-"));
JPanel panel = ... |
588e7346-2870-46e9-b7bb-a649130c17a4 | 4 | int bNNI( double[][] avgDistArray, int count )
{
edge e;
edge[] edgeArray;
heap p, q;
direction[] location;
int i;
int possibleSwaps;
double[] weights;
//FILE *mfile;
p = new heap(size+1);
q = new heap(size+1);
edgeArray = new edge[size+1];
weights = new double[size+1];
location = new directi... |
a9b5f855-413a-4f8b-b702-1f6c088dad83 | 6 | private int processFile(String file, Object[] args) throws IOException{
Utils.setConsoleTitle(file);
Object o2 = null;
try {
o2 = se.invokeFunction(file+".<init>", args);
} catch (NoSuchMethodException e) {
throw new FileNotFoundException(file);
} catch (ScriptException e) {
log.rawprintln(Kind.ERROR... |
3546b53f-72ce-46e8-81b2-209b64ba51a2 | 5 | private void handleLobbyPush() {
while (!Thread.interrupted()) {
try {
// Wait for a notification that the lobby has been
// updated
synchronized (lobbyChangeNotifier) {
lobbyChangeNotifier.wait();
... |
b6da2867-84a2-4c8d-82c8-74145e6510f9 | 9 | public String fTriagle()
{
int IsATriangle;
if (( a < b + c ) && ( b < a + c ) && ( c < a + b ))
{
IsATriangle = 1;
}
else
{
IsATriangle = 0;
}
if (IsATriangle==1)
if (( a == b ) && ( b == c ))
return( "Triangle is Equilateral" );
else if (( a != b ) && ( a != c ) && ... |
e0d24f9a-ae21-424e-b6b6-c9a1ae7fb904 | 0 | public static boolean isApplicable(Object object) {
return object instanceof FiniteStateAutomaton;
} |
828e47ef-51b3-485c-8a46-e54ba6a0999b | 7 | public static ShipComponent buildShipComponent(ShipLocationCommand location, ShipComponentEnumIntf intf) {
ShipComponent shipComponent = null;
switch (location) {
case SHIELD:
shipComponent = new ShieldComponent((ShieldComponentEnum) intf);
break;
case HULL:
... |
5847aa1f-ea3d-4f7b-85d6-66be09c384d3 | 9 | public int minCut(String s) {
int min = 0;
int len = s.length();
boolean[][] matrix = new boolean[len][len];
int cuts[] = new int[len + 1];
if (s == null || s.length() == 0)
return min;
// 初始化cuts里面的值为最坏情况的值
for (int i = 0; i < len; ++i) {
cuts[i] = len - i;
}
// dp过程
for (int i = len - 1; i ... |
25bcd13d-4b7d-4c15-853b-ae12a580f819 | 3 | public NoeudArbre rechercheClef(E clef, int typeRecherche) throws Exercice1Exception {
NoeudArbre result = NIL;
switch (typeRecherche) {
case SEARCH_LIST:
result = rechercheClefList(clef);
break;
case SEARCH_TREE:
if (root != NIL) {... |
bbd936c8-47a8-4a6a-a954-98342c04d49f | 5 | public List getCachingKeys()
{
List ret = null;
if(isCachingActive() && caches != null && caches.size() > 0)
{
ret = new ArrayList();
for(int x = 0; x != caches.size(); x++)
{
CachedEntry entry = (CachedEntry) caches.get(x);
if(entry != null)
ret.add(entry.getKe... |
14536ab1-bde7-47a0-9de2-de94c6592de3 | 1 | public void paintComponent(Graphics g)
{
super.paintComponent(g); // erase background
Graphics2D g2 = (Graphics2D) g;
for (Ball b : balls)
{
g2.fill(b.getShape());
}
} |
89fadfd2-bfff-4e67-9201-fa0234548f18 | 5 | public boolean compareColor(String id, Color color) {
int[] id_attrib = new int[3];
int[] color_attrib = new int[3];
color_attrib[0] = color.getRed();
color_attrib[1] = color.getGreen();
color_attrib[2] = color.getBlue();
for(int i=0;i<identity.size();i++) {
if(identity.get(i).equals(id)) {
... |
cbfece96-9733-4e79-8ff4-039bf8b7f1be | 5 | public void setSensorImage(int paramInt, String paramString)
{
switch (paramInt)
{
case 1:
if (paramString == null)
{
this.Animator.takeActorImage("Sensor-1", "Sensor-2");
this.Animator.takeActorImage("Sensor-2", "Sensor-3");
this.Animator.setActorImage("Sensor-3", null... |
cde6c92e-1e50-4996-b6b5-1e50523e39ac | 2 | public User getUser(String a){
String requete = "select * from User where login='"+a+"'";
try {
Statement statement = MyConnection.getInstance().createStatement();
ResultSet resultat = statement.executeQuery(requete);
while(resultat.next()){
// use... |
348df17f-d421-4424-a38c-15d3c6c82b12 | 9 | protected void extendToString(StringBuffer buffer) {
if (wasChanged)
buffer.append("changed ");
if (wasFrozen)
buffer.append("frozen ");
if (wasPruned)
buffer.append("pruned ");
buffer.append(Modifier.toString(getModifiers()));
buffer.append... |
fa287de3-7497-4ac8-b7af-e7110a8dfa14 | 1 | @Override
public final List<? extends IResource> getResources() throws IOException {
load();
return resources;
} |
bd496a53-95c0-4b7a-bbd0-e92cea79d4a1 | 3 | public static <VertexDataType> void transform(int numVertices, String baseFilename, BytesToValueConverter<VertexDataType> conv,
VertexTransformCallBack<VertexDataType> callback) throws IOException {
VertexData<VertexDataType> vertexData = new VertexData<VertexD... |
7c40ceb2-238c-421b-82e1-2d7f80bf8d03 | 3 | @Override
public void render() {
Message m = Application.get().getLogic().getGame().getCurrentMessage();
if(m != null) {
if(m.priority()) {
super.render();
Renderer.get().drawText(m.getTopic(), x+38, y+5);
int lineLength = maxLength / 12;
... |
e334b461-0cb3-4638-bc2c-485afe0e4cb0 | 5 | public static boolean constant(AlgebraicParticle a){
return a.exponent() == 1 && (a instanceof Number || a instanceof Fraction && ((Fraction)a).constant()
|| a instanceof MixedNumber && ((MixedNumber)a).getFraction().constant());
} |
15b049bc-47c1-498c-b8c3-281c88e6d55f | 4 | @Test
public void testUnsetThenTestDefaults() {
List<String> keys = new ArrayList<String>();
List<String> args = Arrays.asList("unset", "heartbeat");
String scriptResult = "";
try {
scriptResult = (String) _luaScript.callScript("config.lua", keys,
args);
List<String> getArgs = Arrays.asList("get")... |
b32129e1-e67a-4414-8239-8a8709cfd577 | 9 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Ban other = (Ban) obj;
if ((this.player == null) ? (other.player != null) : !this.player.equals(other.pla... |
17d79f9c-6ae3-416f-b026-46862dc1e8cf | 7 | public static synchronized String timeToString(long time, Resolution resolution) {
calInstance.setTimeInMillis(round(time, resolution));
Date date = calInstance.getTime();
if (resolution == Resolution.YEAR) {
return YEAR_FORMAT.format(date);
} else if (resolution == Resolution.MONTH) {
... |
59f571cc-d484-42fa-8236-bc95f7bb42b2 | 4 | public boolean isOnlyOneAlive() {
int playerAlive = 0;
for(Player player : playerList) {
if(!player.getState().equals(Player.States.FOLD) && !player.getState().equals(Player.States.LOSE)){
playerAlive++;
if(playerAlive > 1){
return false;
}
}
}
return true;
} |
fdcdfb9c-f990-483b-9289-785f35aa427e | 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... |
4399c3ea-178a-4a5b-86e6-b50dd0f4e509 | 3 | public BottomBar() {
setBackground(Color.CYAN);
setLayout(new GraphPaperLayout(new Dimension(GameRunner.getNumbPlayers(),12)));
for (int i = 0; i < GameRunner.getNumbPlayers(); i++) {
ArrayList<KComponent> components = new ArrayList<KComponent>();
components.add(new KComponent(new JLabel(GameRunner.ge... |
81c185a5-e5e4-4d79-9ca4-e24ac0101cbc | 6 | public static boolean is_valid (Circle c1){
boolean valid = true;
for (Circle c2 : circles){
if (intersect(c1, c2)){
valid = false;
break;
}
}
if (c1.center_x > c1.radius && c1.center_x < (PANEL_WIDTH - c1.radius));
else
valid = false;
if (c1.center_y > c1.radius && c1.center_y < (PANE... |
f45e5115-7a6d-4e90-8baa-9a428db0dce4 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Resource other = (Resource) obj;
if (type == null) {
if (other.type != null)
return false;
} else if (!type.equals(other.type))
retur... |
244572d8-bf7e-407e-9764-13b71a9f960b | 1 | @Override
public boolean isFeasiblePositionAvailable(Geometry avoids) {
return isEnoughSpaceForLabel && super.isFeasiblePositionAvailable(avoids);
} |
4f7916d4-ee1d-43b3-ada8-d595325534fb | 8 | public void determineWinners() {
//Goes through each player and each hand that they have to check for win/loss conditions
//Subtracts and adds money to the wallets accordingly
for (Player p : playerList) {
for (int i = p.getNumberOfHands() - 1; i >= 0; i--) {
if (p.getHand(i).getPoints() > 21) {
dial... |
eed8c487-969e-447e-ac2c-134b86ae0e1a | 8 | * @param dump If true, dump the goods.
*/
public void unloadCargo(Goods goods, boolean dump) {
if (!requireOurTurn()) return;
// Sanity tests.
if (goods == null) {
throw new IllegalArgumentException("Null goods.");
} else if (goods.getAmount() <= 0) {
th... |
717621cb-3157-4d21-9248-8129ffd90c2e | 6 | private void initTable(){
/*
* This gives opportunity to set sells in table as manually no editable
*/
TableCellEditor nonSelEditor = new TableCellEditor() {
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, ... |
a5ae25c3-7b3c-4e8f-8415-24e28e1f93ce | 4 | public void run() {
byte[] buffer = new byte[BUFFER_SIZE];
DatagramPacket packet = new DatagramPacket(buffer, BUFFER_SIZE);
DatagramSocket socket = getSocket();
while (listening) {
try {
try {
socket.receive(packet);
} catch (SocketException ex) {
if (listening) {
throw ex;
} els... |
2e586550-7837-47fb-9f04-0bf71b724de8 | 9 | public void read()
{
Object obj = null;
while(!done)
{
searching = true;
while(searching)
{
bufferString = buffer.toString();
tagStart = bufferString.indexOf("<", searchStart);
if(tagStart < 0)
... |
07a31275-d9b2-4d15-b68c-a298d0d56156 | 0 | @Override
public void gameRenderMovement() {
} |
d358d841-fff5-4ee0-b783-f83e9ce4aa86 | 9 | public boolean readFile(){
try {
this.inputReader = new BufferedReader(new FileReader(this.path + inputFileName));
while (this.inputReader.ready()) {
String sLine = this.inputReader.readLine();
if (!sLine.equals(null) && sLine.length() >= 1) {
if (sLine.substring(0, 1).matches(regex)) {
Sy... |
95606843-c048-4452-be09-833cd7a95f9c | 8 | protected void retrieveRobot(Robot paramRobot)
{
this.BayOccupied = true;
this.RobotOnRamp = paramRobot;
this.RampUp = true;
this.RCXName.setText(paramRobot.getName());
this.PartsList.setContents(null);
this.state.removeRobot(paramRobot);
this.WeightGauge.setMax(paramRobot.getChassis().... |
871f89c2-7277-4022-8ade-45fcfa814baa | 5 | @Override
public void imprimir() {
try{
rCuentas.seek(0);
while(rCuentas.getFilePointer() < rCuentas.length() ){
int cod = rCuentas.readInt();
String tipo = rCuentas.readUTF();
String n = rCuentas.readUTF();
double sal =... |
2739badd-2b10-4497-a770-12d54e6a9025 | 6 | private int partition(Comparable[] arr, int lo, int hi) {
Comparable tmp = arr[lo];
int i = lo, j = hi + 1;
while (true) {
while (tmp.compareTo(arr[--j]) < 0) if (j == lo) break;
while (tmp.compareTo(arr[++i]) > 0) if (i == hi) break;;
if (i >= j) break;
SortEverything.swap(arr, i, j);
}
SortEvery... |
e2dea55e-f028-47f8-8422-912330007e86 | 0 | public PermissionOp getOP() throws DataLoadFailedException {
return dataHolder.getOP();
} |
8fcbb206-d5d4-49b7-95a3-b82ba2d7fc85 | 7 | @Override
public MOB getQuestMob(int i)
{
final int[] num={1};
Environmental E=null;
synchronized(questState)
{
if(questState.worldObjects!=null)
E=getQuestThing(PreservedQuestObject.getPOIter(questState.worldObjects),i,CMClass.CMObjectType.MOB,num);
if(E instanceof MOB)
return (MOB)E;
if(que... |
91fe8d99-f60e-45cd-a16f-e23a10a80bc0 | 0 | public int getAccountId() {
return this.accountId;
} |
af8802db-e621-400c-aad5-d7eab6070537 | 2 | @Override
public void run()
{
try
{
Process p1;
OutputWriter outputWriter;
OutputWriter errorWriter;
InputGetter inputGetter;
p1 = Runtime.getRuntime().exec(executionPath);
outputWriter= new OutputWriter(p1... |
82589b71-2a34-4121-9be3-96d772ff8710 | 2 | @Override
public Object execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
Contexto oContexto = (Contexto) request.getAttribute("contexto");
oContexto.setVista("jsp/backlog/form.jsp");
BacklogBean oBacklogBean;
BacklogDao oBacklogDao;
oBacklo... |
42e29514-bf7e-453e-8b90-7bcb19d10489 | 1 | public void addElement(E element) {
if (array.length > currentSize) {
array[currentSize] = element;
currentSize++;
} else {
checkEnoughCapacity(1);
array[currentSize] = element;
currentSize++;
}
} |
5a383c75-ee9a-46e7-8da3-751b0421695f | 1 | public static double dsGrad(double[] obs, double[] sim) {
sameArrayLen(obs, sim);
int dsLength = sim.length;
double[] cumPred = new double[dsLength];
double[] cumVali = new double[dsLength];
double cp = 0;
double cv = 0;
for (int i = 0; i < dsLength; i++) {
... |
1d2d2072-67a0-4fb7-8f56-1c6735f84455 | 3 | public static byte[] decryptBloc(byte[] in) {
byte[] tmp = new byte[in.length];
byte[][] state = new byte[4][Nb];
for (int i = 0; i < in.length; i++)
state[i / 4][i % 4] = in[i%4*4+i/4];
state = AddRoundKey(state, w, Nr);
for (int round = Nr-1; round >=1; round--) {
state = InvSubBytes(state);
sta... |
fd4537b0-1dc0-41dd-a0e8-9aa7543c122a | 6 | private void addSearchPanel() {
Dimension inputDimension = Constants.getInputDimension();
Dimension dateDimension = Constants.getDateDimension();
searchPanel = new JPanel();
searchPanel.setBorder(new TitledBorder("查询条件"));
searchPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
... |
fd7ad060-1282-4b1e-bf01-3fa19b9c630a | 4 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Activity other = (Activity) obj;
if (!Objects.equals(this.name, other.name)) {
return false;
}
if (!Objects.equals(this.description, other.description)) {
... |
5453800a-a8c8-46aa-a5cf-47a8947eccd9 | 6 | public PolicyFinderResult findPolicy(URI idReference, int type,
VersionConstraints constraints,
PolicyMetaData parentMetaData) {
// see if the URI is in fact a URL
URL url = null;
try {
url = new URL(id... |
e63dd67c-b6c5-4e2a-b15c-60528c192bf3 | 6 | private static ArrayList<String> getSkuList(String centroid,
HashMap<String, ArrayList<String>> cluster,
HashMap<String, ArrayList<String>> qSkuMap, String query) {
ArrayList<String> sList = new ArrayList<String>();
ArrayList<String> qList = cluster.get(centroid);
HashMap<String, Float> dist = new HashMap<S... |
8facba23-8b0e-49cd-95c2-e822dfaee5a4 | 1 | public boolean setShutdownmenuButtonWidth(int width) {
boolean ret = true;
if (width < 0) {
this.buttonShutdownmenu_Width = UISizeInits.SHDMENU_BTN.getWidth();
ret = false;
} else {
this.buttonShutdownmenu_Width = width;
}
somethingChanged();... |
ffca3f1b-b084-47c3-b0a0-52688d8303d2 | 1 | public void clear() {
GameActor[] toClear = actors.values().toArray(new GameActor[actors.size()]);
for(GameActor a : toClear) {
Application.get().getEventManager().queueEvent(new ActorDestroyedEvent(a));
}
} |
60a51435-927e-4f5a-b0b4-bf308d6c74ff | 8 | public static Class<?> findCommonElementType(Collection<?> collection) {
if (isEmpty(collection)) {
return null;
}
Class<?> candidate = null;
for (Object val : collection) {
if (val != null) {
if (candidate == null) {
candidate = val.getClass();
}
else if (candidate != val.getClass()) {
... |
216670a3-38c7-4696-a5bc-07998aeb4ad1 | 9 | public static Level parseLogLevel(String levelName)
throws ParseException
{
if (levelName.equals("off"))
{
return Level.OFF;
}
else if (levelName.equals("severe"))
{
return Level.SEVERE;
}
else if (levelName.equals("warning"))
{
return Level.WARNING;
}
else if (levelName.equals("info"))
... |
3def955e-5b10-40fe-bff1-c318baba78d9 | 2 | public BSPlayer getPlayer(String name){
for(BSPlayer player: members){
if(player.getName().equals(name)){
return player;
}
}
return null;
} |
df9d8d70-93df-482f-97e0-4a2ee0e64982 | 8 | @Override
public boolean onCommand(CommandSender sender, ItemStackRef itemStackRef, Command command, String label, String[] args) {
// Check the player is holding the item
ItemStack held = itemStackRef.get();
if (held == null || held.getTypeId() == 0) {
sender.sendMessage(plugin.... |
6474bc87-843c-4289-ad5a-39896681c2d2 | 4 | private double getScaledDuration(Integer user, Integer tag) {
long tagFirst = 0;
if (userTagFirstMapping.containsKey(user) && userTagFirstMapping.get(user).containsKey(tag)) {
tagFirst = userTagFirstMapping.get(user).get(tag);
}
long tagLast = 0;
if (userTagLastMapping.containsKey(user) && userTagLast... |
ef6840b5-bc2d-4ffe-936c-e76c873beac1 | 5 | private char[][] readFile (File keyFile) throws Exception {
char[][] newKey = new char[4][4 * 11];
Scanner fileScanner;
try {
fileScanner = new Scanner(keyFile);
} catch (Exception e) {
// the file is checked before this point, so this should never execute.
System.out.println("FileInputStream threw ... |
62fcf810-fe8e-4dcd-a186-8fb73a6cab0f | 7 | private JLabel[] buildHeaders(int match, JPanel panel, boolean blankOut, JLabel[] clabels) {
Vector columns = null;
if (cdata != null)
columns = cdata.getColumnData(match);
if (columns != null && columns.size() > 0) {
JLabel[] columnLabels = new JLabel[columns.size()];
for (int i = 0; i < columns.size(... |
cd3b7d20-7328-499e-b85b-d83167fb1cca | 1 | public void deleteRow(String fileName) {
if (fileName.equals((String) tableModel.getValueAt(selectedRow, 3))) {
tableModel.deleteRow(selectedRow);
}
} |
205f11ee-216c-4767-ace5-7e4e394ff56a | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PlanetEntrance other = (PlanetEntrance) obj;
if (entrance != other.entrance)
return false;
if (planet == null) {
if (other.planet != null... |
591e7e9e-4abe-420b-915a-ba2f65898440 | 1 | private void compute_pcm_samples10(Obuffer buffer)
{
final float[] vp = actual_v;
//int inc = v_inc;
final float[] tmpOut = _tmpOut;
int dvp =0;
// fat chance of having this loop unroll
for( int i=0; i<32; i++)
{
final float[] dp = d16[i];
float pcm_sample;
pcm_sample = (float)(((vp[10 +... |
ec614b94-76d1-414f-ad67-635c5b6e01f1 | 1 | public void readTable() {
try {
TranslationTable table = new TranslationTable();
InputStream input = new FileInputStream(inTableFile);
table.load(input);
input.close();
basePackage.readTable(table);
} catch (java.io.IOException ex) {
GlobalOptions.err.println("Can't read rename table " + inTableFi... |
96e4bea4-f64a-4138-a9fd-c3c897952edf | 0 | private void writeObject(java.io.ObjectOutputStream out) throws IOException {
out.writeInt(id);
out.writeUTF(Name);
System.out.println("write Object");
} |
11ff244f-0cb4-426d-89d7-95534deae2c0 | 6 | public void paintComponent(Graphics g) {
if (width == numbers.length && height == numbers[0].length &&
width == black.length && height == black[0].length) { // while not resizing
super.paintComponent(g); // draws the background color
if (firstTime) {
renewGridImage();
renewFieldsImage();
//rene... |
631c6711-a1e3-40cd-959c-e0775da594c8 | 4 | public int register(String username, String password){
try {
String host = "localhost";
socket = new Socket(host, 2001);
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
out = new PrintWriter(socket.getOutputStream(), true);
... |
b0007270-155a-4527-bcbf-2f8821a434f7 | 7 | @EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
Player player = event.getPlayer();
Block block = event.getClickedBlock();
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return;
//ADD BLOCK
if (Cache.addBlocksCache.contains(player)) {
Teleporter teleporter = Cache.aktTeleport... |
41ec7b0c-826f-4f4b-9e16-b959523ab578 | 3 | private void goRight(ColorPatch patch, int x, int y) {
if ( ++x < image.getWidth() ) {
Color color = pixel(x, y);
if ( isIncluded(x, y) ) {
if ( patch.getColor().distance(color, Color.RGB_DISTANCE) < tolerance ) {
patch.add(color);
goDown(patch, x, y);
goRight(patch, x, y);
}
}
excl... |
9a93f4bf-6118-4f1f-a098-a91a0003a7f8 | 6 | public static void main(String [] argumentos) {
ObjectOutputStream objeto1= null;
try{
borrarPantalla();
objeto1 = new ObjectOutputStream(new FileOutputStream("ficheros/personas.dat"));
boolean terminar = false;
while (!terminar) {
Persona ... |
6846a532-47a8-4257-8187-f0109f8cc658 | 5 | private static boolean method311(int arg0, int arg1, int arg2) {
int l = arg1 * SceneGraph.anInt460 + arg2 * SceneGraph.anInt461 >> 16;
int i1 = arg1 * SceneGraph.anInt461 - arg2 * SceneGraph.anInt460 >> 16;
int j1 = arg0 * SceneGraph.anInt458 + i1 * SceneGraph.anInt459 >> 16;
int k1 = arg0 * SceneGraph.anInt45... |
6be9a608-268c-4933-b4e4-f87fbe5ff0ff | 9 | private void newBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newBtnActionPerformed
if (tabbedPane.getSelectedIndex() == 1) {
if (!DayFrame.isInstanceAlive()) {
new DayFrame(this, c, NIL);
}
} else if (tabbedPane.getSelectedIndex() == 2) {... |
420a476f-8f58-4a3c-8187-5d3559fa1763 | 1 | @Override
protected
AbstractPage parseChild(Element element) throws ProblemsReadingDocumentException {
try {
trackCounter++; // that includes counting for failed parsing
URL u = resolveLink(element.getAttributeValue("href"));
Track t;
t = new Track(u.toString(), getChildrenSaveTo(), this);
t.setTit... |
30933df1-494d-4b1a-b35d-52f09d598d9a | 3 | public static float[] toFloatA(byte[] data) {
if (data == null || data.length % 4 != 0) return null;
// ----------
float[] flts = new float[data.length / 4];
for (int i = 0; i < flts.length; i++) {
flts[i] = toFloat( new byte[] {
data[(i*4)],
data[(i*4)+1],
... |
c2f33360-64da-4267-aca0-048fe24e9711 | 5 | public void update(final int start, final int end) {
new Thread(new Runnable() {
@Override
public void run() {
for (int i = start; i < end; i++) {
monsters.get(i).update();
if (!GameServer.users.isEmpty()) {
... |
6d494957-4a6c-4f4a-9b50-a27e501801ef | 2 | public List<String> getResultingStatesValuesByStateAndPureSymbol(String state, String symbol) throws Exception{
List<String> result = new ArrayList<String>();
for(Transition tran: transitions){
if(tran.matchByStateAndPureSymbol(state, symbol, getSymbolByAlter(tran.getSymbolRef())))
... |
4151e18f-ef3d-43e7-8ad4-677f6a6fbb26 | 7 | private void loadAll() {
mFiles = new LinkedHashSet<String>();
mDirs = new LinkedHashMap<String, AbstractDirectory>();
int prefixLen = getPath().length();
Enumeration<? extends ZipEntry> entries = getZipFile().entries();
while (entries.hasMoreElements()) {
Zi... |
450ec42b-9da8-4d8f-8d92-3d89c97844ba | 4 | public void excute() {
String url = baseurl + category;
System.out.println(url);
Document html = WebClient.getHtmlByUrl(url);
Elements group_elements = html
.select("div[class=all_lanmu ping] > ul > li");
for (Element e : group_elements) {
// claw each group
clawEachGroup(e.select("a").first().attr(... |
6abae24c-80fa-4913-8d13-5b52925cae76 | 1 | public void visitMaxs(final int maxStack, final int maxLocals) {
if (mv != null) {
this.maxStack = Math.max(this.maxStack, maxStack);
this.maxLocals = Math.max(this.maxLocals, maxLocals);
mv.visitMaxs(this.maxStack, this.maxLocals);
}
} |
b5b14f1c-f53d-4b1f-9f4a-44d2a92741ae | 6 | public static void main(String[] args)
{
String cadena_1, cadena_2, c;
cadena_1=(JOptionPane.showInputDialog("Ingrese Cadena_1"));
cadena_2=(JOptionPane.showInputDialog("Ingrese cadena_2"));
cadena_2=cadena_2.toLowerCase();
c=cadena_2.toUpperCase();
int l... |
3027c2f2-6da8-4353-9f57-ad8dcf333009 | 6 | private void getCardsInformation() throws Exception {
out.println(nodeName);
Enumeration<NetworkInterface> interfaces = NetworkInterface
.getNetworkInterfaces();
ArrayList<String> wlsMac = new ArrayList<String>();
ArrayList<String> wlsName = new ArrayList<String>();
while (interfaces.hasMoreElements()) {
... |
766b36ce-bebc-4ea4-beea-5c890120df84 | 9 | public void levelWater() {
for (int i = 0; i < size - 1; i++) {
for (int j = 0; j < size - 1; j++) {
if (getAlt(i, j) < waterLevel) {
setType(i, j, Type.WATER);
setAlt(i, j, waterLevel);
}
}
}
for (int i = 0; i < size - 1; i++) {
for (int j = 0; j < size - 1; j++) {
if (getType... |
013c87cb-31f8-4a34-97f3-f0f0adfcb655 | 5 | public boolean isDefined() {
return (this.x1 != null && this.x2 != null && this.y1 != null && this.y2 != null && this.z1 != null && this.z2 != null);
} |
edd84576-f561-4aa7-bdd3-e6f87894ebdc | 3 | public static WorkflowStatusEnumeration fromString(String v) {
if (v != null) {
for (WorkflowStatusEnumeration c : WorkflowStatusEnumeration.values()) {
if (v.equalsIgnoreCase(c.toString())) {
return c;
}
}
}
throw new IllegalArgumentException(v);
} |
d7663a04-e88b-45ae-9b8a-441d53c35a63 | 2 | public void setShape(String id, int type) {
for(int i=0;i<identity.size();i++) {
if(identity.get(i).contains(id)) {
attrib_bounds = new int[6];
attrib_bounds[0] = type; //Shape ID
attrib_bounds[1] = bounds.get(i)[1]; //X co-ord
attrib_bounds[2] = bounds.get(i)[2]; //Y co-ord
... |
0d969ebd-346b-4f2b-961e-25acb1a674f1 | 6 | public static int Func(int i,int S,int B){
int result1=0,result2=0;
if(i<1 || S<1 || B<1)return 0;
if(OPT[i][S][B] !=-1) return OPT[i][S][B];
if(S-arr[i].nos >=0 && B-arr[i].nob >=0){
result1= arr[i].g + Func(i-1,S-arr[i].nos,B-arr[i].nob);
}
result2= Func(i-1,S,B);
return Math.max(result1, resul... |
1d26c91a-5d18-4400-a7f7-aa9bd4ad7aa2 | 0 | public LambdaTransitionChecker() {
} |
1ad31ede-6965-4bb0-8675-87d82a3bcf48 | 2 | @Override
public void put(E item) throws InterruptedException {
lock.lock();
try {
if (isFull()) {
System.out.println("Клієнт №" + item + " очікує в черзі на вулиці");
}
while (isFull()) {
notFull.await();
}
... |
78843712-6029-4a8a-9295-4561226ad392 | 6 | public static String getString(final String msg, final String defaultValue) {
ConsoleMenu.print(msg + (defaultValue != null ? " (default:" + defaultValue + ") " : ""));
BufferedReader bufReader = null;
String opt = null;
try {
bufReader = new BufferedReader(new InputStreamR... |
63081bb1-c02b-47a2-97fa-9bb727205a01 | 8 | private static Unwrapper getSpecificUnwrapper(Class<?> type) {
// See if we're already determined this
if (unwrapperCache.containsKey(type)) {
// We will never remove from the cache, so this ought to be thread safe
return unwrapperCache.get(type);
}
try {... |
111b3ba1-151c-49ab-8568-e71cd7e53193 | 1 | static String getClassPref(Class c) {
if (c.isPrimitive()) {
return c.getSimpleName();
}
return "Object";
} |
3b8b4d69-5bc0-4057-a4bb-d01ba995fca3 | 4 | public boolean deselect() {
if (!selected()) {
return true;
}
return (ctx.game.tab() == Game.Tab.INVENTORY || ctx.game.tab(Game.Tab.INVENTORY)) && selectedItem().interact("Cancel") && Condition.wait(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
return !selected();
}... |
03fd7c80-f1e2-4583-aad2-0e1bfad4eb73 | 7 | private void flood_fill_points(char[][] map_copy, Character[] tiles, int w, int h,
char color, Stack<Point> tolook) {
while (!tolook.isEmpty()) {
Point p = tolook.pop();
int x = p.x, y = p.y;
if (!(x > -1 && x < w && y > -1 && y < h)) {
// out of map bounds
continue;
}
Linked... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.