method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
0184fe11-c432-428d-a9ec-4c452e3664b9 | 9 | private static int assignType(int color)
{
int type = BACKGROUND;
int minDist = 999999;
// extract the r,g,b components
int r = color >> 10;
int g = (color >> 5) & 31;
int b = color & 31;
// convert to 8 bit per component
r = r... |
760b289d-47b3-4779-9790-931ec066d259 | 8 | public String toString(){
StringBuffer sb = new StringBuffer();
switch(type){
case TYPE_VALUE:
sb.append("VALUE(").append(value).append(")");
break;
case TYPE_LEFT_BRACE:
sb.append("LEFT BRACE({)");
break;
case TYPE_RIGHT_BRACE:
sb.append("RIGHT BRACE(})");
break;
case TYPE_LEFT_SQUARE:
... |
5b584442-b10e-4191-91c0-0986929398c1 | 0 | public void addDirtyRegion(JComponent c, int x, int y,
int w, int h)
{
// do nothing
} |
a211ed56-141e-423f-a2cf-6cc6cc10d355 | 1 | public final Object get(int index) throws JSONException {
Object o = opt(index);
if (o == null) {
throw new JSONException("JSONArray[" + index + "] not found.");
}
return o;
} |
be93b42a-9c05-46b6-b0af-03e43632ddaa | 6 | @EventHandler
public void EndermanWaterBreathing(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getEndermanConfig().getDouble("End... |
230de190-7931-4fac-b5b0-5435af8367fb | 6 | private boolean isEnabled(int i) {
switch (i) {
case SUPGA:
return DO_SUPGA;
case ECHO:
return DO_ECHO;
case NAWS:
return DO_NAWS;
case TTYPE:
return DO_TTYPE;
... |
f9d74f0e-89ae-4a07-8b3c-0400325c1abd | 7 | private void execute() {
String letters= "ABCDEFGHIJ";
double start = System.currentTimeMillis();
while (true){
System.out.println("Give me a move (Example -->(5A,4A) or (help) ): ");
String text = SCANNER.nextLine().toUpperCase();
if (text.toLowerCase().equals("help")){
help();
}else{
... |
7ebccd09-c9e1-494e-a028-be6eaf38c150 | 5 | public static String fromBase64(String bianry){
int lenght = bianry.length() - 1;
char last = bianry.charAt(lenght), secL = bianry.charAt(lenght - 1);
char[] derp = bianry.toCharArray();
String theEnd = "";
for(int i = 0; i < derp.length; i++){
int temp = Base64.indexOf(derp[i]);
theEnd += toBinar... |
a42f02d6-2ae4-4acf-b804-411fd0d54a5d | 3 | public static void main(String[] args) {
if(System.getProperty("os.name").startsWith("Windows")) {
System.setProperty("org.lwjgl.librarypath", System.getProperty("user.dir") + "/native/windows");
} else if(System.getProperty("os.name").startsWith("Mac")) {
System.setProperty("org.lwjgl.librarypath", System.ge... |
f3a7be4a-b133-4c00-a2c3-f5d47a8ffdaf | 3 | public SignatureVisitor visitArrayType() {
if (type != TYPE_SIGNATURE || state != EMPTY) {
throw new IllegalStateException();
}
state = SIMPLE_TYPE;
SignatureVisitor v = sv == null ? null : sv.visitArrayType();
return new CheckSignatureAdapter(TYPE_SIGNATURE, v);
} |
4e1032f7-f5c8-4ed1-a42f-836d802a3763 | 5 | @Override
public boolean equals(Object o) {
if (this == o)
return true;
if (!(o instanceof Matrix))
return false;
Matrix m = (Matrix) o;
for (int i = 1; i <= this.getM(); i++) {
for (int j = 1; j <= this.getN(); j++) { // compare Doubles with
// delta = 0.0000001
if (Double.compare... |
2c57284e-2b5e-42c7-a157-592e24afaf63 | 7 | private final void step6() {
j = k;
if (b[k] == 'e') {
int a = m();
if (a > 1 || a == 1 && !cvc(k-1))
k--;
}
if (b[k] == 'l' && doublec(k) && m() > 1)
k--;
} |
a8236a6f-dfe4-437d-83fb-c53e4ce79c48 | 5 | public ArrayList<Artist> list(String artistName) throws URISyntaxException{
log.trace("Retrieving artists list");
String name;
String id;
JsonElement artistsAsJson = null;
ArrayList<Artist> artists = new ArrayList<Artist>();
JsonObject response = new JsonObject();
if(currentArtist == null || !currentA... |
46d6f31c-19a1-483a-bb35-41f2fe7aff27 | 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... |
b7ece4fe-c4ad-4eff-98f8-8994275f85a3 | 0 | public LogUser() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
JButton btnEntrar = new JButton("Entrar");
btnEntrar.addActionListener(new ActionListener() {
... |
8b706706-686a-425e-9ba2-d67ded7e69ef | 0 | public Client() {
} |
d26bd29e-81e8-4d88-9128-5ae4ebbceab0 | 7 | public boolean equalsPredicate(Predicate p){
if(p.getName().equals(this.name)){ // checks the name
// Checks each variable
int[] hasV = this.hasVariables(p.getVariables());
if(hasV[0] == -1){
return false;
} else if(hasV[0] == -2){
return false;
} else {
boolean equal = true;
int i = 0;... |
fe90b409-c978-41b4-ac58-6862a48b55c5 | 2 | public void tick()
{
for(Integer i : barMap.keySet())
{
barMap.get(i).tick();
}
if(window != null)
{
window.tick();
}
} |
5444a271-0a96-413e-b7b0-2925eec01330 | 6 | @Override
public void Play(PlayerResponse response) {
if(response != null) {
int playerNumber = response.getBid();
lastMove = response;
if(num1 == -1) {
num1 = playerNumber;
currentTurn = Position.South;
currentMessage = "Guess a number between 1 & 100 " + getPlayer(currentTurn).getUser().getUse... |
309b77aa-c68c-4991-b930-15fc790f1534 | 9 | public void creerPioche(int nombrePaquet){
int[] valeurCarte = new int[8];
int[] valeurCarteSpeciale = new int[5];
int i,j,k;
String[] couleurCarte = new String[4];
couleurCarte[0]="coeur";
couleurCarte[1]="carreau";
couleurCarte[2]="trefle";
couleurCarte[3]="pique";
valeurCarte[0]=3;
valeurCa... |
5d7a4c3a-8196-4e2b-9a10-86dd6d94b107 | 4 | public static int[] outputWordsPosition(ArrayList<String> list,
ArrayList<String> sameSet, int[] counts){
int i = list.size();
int[] positions = new int[sizeOfComputing];
counts[0] = 0;
counts[1] = 0;
for(String str : list) {
for(String sameSt... |
e4c2698b-72f2-4cfd-9fae-a49090c4d979 | 3 | public int compareTo( Object obj )
{
//right now only sort by the index.
if ( obj instanceof StringEntry == false )
{
throw new IllegalArgumentException( "object must be a StringEntry" );
}
StringEntry se = (StringEntry) obj;
if ( se.getIndex() < this.... |
15fdd338-4eb9-4949-ab66-e187bfb6784f | 9 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
dateChooserCombo1 = new datechooser.beans.DateChooserCombo();
... |
9f1a0147-9da7-43b8-811f-c64bb4f21b1f | 3 | public void updateNetwork() {
try {
while (selector.selectNow() > 0) {
for (Iterator<SelectionKey> it = selector.selectedKeys().iterator(); it.hasNext(); ) {
SelectionKey key = it.next();
handleReadyKey(key);
it.remove();
}
}
} catch (IOException e) {
e.printStackTrace();
}
} |
c0a9cfe1-0765-457b-adc3-e9715a66bf72 | 6 | public static void main(String[] args) throws IOException {
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(System.in));
// let's Construct the tree(max 9 int numbers)
Arbol arbol = new Arbol();
int b, cont = 0;
Object obj;
System.out
.println("Input 9 int numbers one-by-... |
4a8a7bcd-d5d8-49e5-a8ad-33e62be8f05c | 9 | public PositionInterpretor(int position){
if(position==0){
x=0;
y=0;
}if(position==1){
x=0;
y=1;
}if(position==2){
x=0;
y=2;
}if(position==3){
x=1;
y=0;
}if(position==4){
x=1;
y=1;
}if(position==5){
x=1;
y=2;
}if(position==6){
x=2;
y=0;
}... |
e94e0538-875e-41ab-bc6c-b8756639b82e | 5 | @Override
public void start(Stage primaryStage) throws JAXBException {
primaryStage.setTitle("Game Engine Test");
primaryStage.setScene(new Scene(root));
/*
* lijst vn componenten
*
* falsspelen met root ...
*/
model = new Model(root);
... |
8a565294-a109-48cd-912f-400f5668556b | 3 | @Override
protected void drawLayoutObject(Graphics g, Edge edge) {
//only draw those that appear to be "walls" and have been visited
if (!edge.isCrossableByDefault() && edge.isVisited()){
g.setColor(DEFAULT_EDGE_COLOR);
g.fill3DRect(getEdgeRectangle(edge, true).x, getEdgeRectangle(edge, true).y, ... |
59132553-a31a-4e0a-9466-4007f0a416aa | 5 | void writeWordsRec(List<CharNode> children) {
if (children == null || children.size() == 0) {
return;
}
final int childCount = children.size();
addCount(childCount);
//int childrenStart = dictSize;
int[] childrenAddresses = new int[childCount];
for (in... |
b63aec15-c487-4723-8b47-4edd50c68f83 | 6 | public static boolean unzipFile(File filename,File where) throws IOException{
ZipFile zipFile = new ZipFile(filename);
Enumeration files = zipFile.entries();
FileOutputStream fos = null;
while (files.hasMoreElements()) {
try {
ZipEntry entry = (ZipEntry) file... |
942a052a-b3c2-4f6c-a8e3-632f95181766 | 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 an... |
96c979fc-a722-4faf-9cb9-bc0969080381 | 5 | public MasterFrame(Account a, LoginScreen ls) {
// Initialize components.
this.a = a;
login_screen = ls;
top_panel = new JPanel();
logout_button = new JButton("Logout");
back_button = new JButton("Back");
settings_button = new JButton("Settings");
role_label = new JLabel(); // Chan... |
c7392402-8a0f-47a0-825e-d6dfe59778b9 | 4 | private String pull(int n) throws RemoteException{
ArrayList<Message> messages = new ArrayList<Message>();
if(iPriv != null){
while(!finished) {
messages.addAll((ArrayList<Message>) iPriv.getUserMessages(this));
messageGet = messages.size();
}
finished = false;
messageGet = 0;
StringBuilder s... |
3654ac59-29b3-461f-92a9-d71e0f7ccf90 | 3 | public static int RodCutBottomUp(int n, int[] p) {
int[] s = new int[p.length+1];
for (int i=0; i!=s.length; ++i)
s[i] = Integer.MIN_VALUE;
// base case and trivial case
s[0] = 0;
s[1] = p[0];
// build up the table
for ( int i=2; i <= n; ++i ){
int max = Integer.MIN_VALUE;
for (... |
e8fbe869-e965-4c84-80ff-da8b2a50e721 | 3 | public int getLargest() {
int largest = 0;
for (int row = 0; row < matrix.length; row++) {
for (int col = 0; col < matrix[0].length; col++) {
if (matrix[row][col] > largest) {
largest = matrix[row][col];
}
}
}
return largest;
} |
d19bf698-6e52-44b7-b7d6-368b31e1372d | 1 | @Override
public byte[] getHTTPMessageBody() {
try {
return Files.readAllBytes(Paths.get(serverViewsDirectory + "/405.html"));
} catch (IOException e) {
e.printStackTrace();
return "File Could Not Be Read".getBytes();
}
} |
85a25730-04a6-4d90-91d1-cec634ead191 | 3 | @Override
public Object evaluate(Context context) {
Iterator<Term> i = terms.iterator();
Term first = i.next();
Object value = first.operand.evaluate(context);
while (i.hasNext()){
Term next = i.next();
switch (next.operator){
case MULT: value = Operations.mul(value, next.operand.evaluate(context))... |
f934fa2e-cd95-4b66-b4b5-9f2dd6b8afb6 | 0 | public void setIdConnection(Integer idConnection) {
this.idConnection = idConnection;
} |
b7a39e31-b364-4f58-9420-1d3a5765bfb4 | 0 | public ITaintPropagationWrapper getTaintWrapper() {
return this.taintWrapper;
} |
1c5ef3a7-956d-4b4c-855b-f8f22e538e71 | 8 | public static String parseRemoteInterfaceName (Class<?> initClass) {
Class<?>[] interfaces = initClass.getInterfaces();
Class<?> remoteInterfaceName = null;
boolean breakFlag = false;
for (int i = 0; i < interfaces.length; i++) {
Class<?>[] nestedInterfaces = interfaces[i].getInterfaces();
for (int j = 0;... |
596f1d75-2683-4ad7-8644-763762d327b7 | 5 | private String makeListString(String driverName, int[] pitstopLap, int stops, int pase) {
StringBuilder pitString = new StringBuilder();
int adLap = 0;
//evaluamos la variable pase si esta no es 1 o 2 adLap vale 0.
adLap = pase == 1 ? 1 : pase == 2 ? -1 : 0;
switch (stops) {
... |
ff1b1f6b-479f-4c35-8b50-b66fcdc59a2f | 6 | @Test
public void creatorTest2() {
userInput.add("hello");
userInput.add("daniel");
userInput.add("can you help me with cooking");
userInput.add("tell me the creator");
userInput.add("hamburger");
userInput.add("creator");
runMainActivityWithTestInput(userInput);
assertTrue(nlgResults.get(2).contains("... |
33687f45-0d7d-44e9-b379-d081b214d9b0 | 2 | public void updateLevel(Level level)
{
PreparedStatement ps;
try {
if(level.getId() > 0)
{
ps = con.prepareStatement("UPDATE teacher SET name=?, value=? WHERE id=?");
ps.setInt(3, level.getId());
}
else
{
ps = con.prepareStatement("INSERT INTO teacher (name, value) VALUES (?, ?)");
}
... |
88757dc1-15c6-4a70-b062-d9d2db78b7c6 | 0 | public String toString() {
return heading + " (" + timestamp.toString() + ") -" + news + "\n-"
+ author;
} |
2b68978c-2e1c-42eb-854c-00f8eb0ce268 | 3 | private int createShader(String _file, int _shaderType) throws Exception {
int shader = 0;
try {
shader = ARBShaderObjects.glCreateShaderObjectARB(_shaderType);
if(shader == 0)
return 0;
ARBShaderObjects.glShaderSourceARB(shader, readFileAsString(_file));
... |
813e8637-1210-40df-a738-1747868d0211 | 4 | public void mouseReleased(MouseEvent e) {
if (dragNormal && (e.getModifiers() & InputEvent.BUTTON1_MASK) != 0) {
dragNormal = false;
onFinalValueChange();
}
if (dragPrecise && (e.getModifiers() & InputEvent.BUTTON3_MASK) != 0) {
dragPrecise = false;
onFinalValueChange();
}
} |
f40277cb-849f-461b-a13b-133d4cea6d5a | 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... |
64598d9a-9b53-46bc-b34b-015dca02bd47 | 9 | private LinkedList<Diff> diff_lineMode(String text1, String text2,
long deadline) {
// Scan the text on a line-by-line basis first.
LinesToCharsResult b = diff_linesToChars(text1, text2);
text1 = b.chars1;
text2 = b.chars2;
List<String> linearray = b.lineArra... |
ea551078-fc17-4346-afc5-17d11efbbc9b | 9 | public boolean equals (Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
PrivateFields other = (PrivateFields)obj;
if (QTime == null) {
if (other.QTime != null) return false;
} else if (!QTime.equals(other.QTime)) return fals... |
f9cd05bc-09c6-497a-b2a2-03a0dc365378 | 2 | public Database(String url, String user, String password){
try {
Class.forName("org.postgresql.Driver");
} catch (ClassNotFoundException e1) {
e1.printStackTrace();
}
try {
conn = DriverManager.getConnection(url,user,password);
} catch (SQLException e) {
e.printStackTrace();
}
} |
869460d0-f14f-41fc-8415-cfcd57ec542c | 6 | public static final boolean contentEquals( Object c1, Object c2 ) {
if( c1 == null && c2 == null ) return true;
if( c1 == null || c2 == null ) return false;
if( c1 instanceof byte[] && c2 instanceof byte[] ) {
return equals( (byte[])c1, (byte[])c2 );
}
return c1.equals(c2);
} |
58664c05-5c93-4ff2-a826-f30bc16554db | 1 | public void stopTick() {
if (_level.ticks.contains(this))
_level.ticks.remove(this);
} |
c43c0459-35ec-49d3-8d88-c08138e57a8c | 9 | public int maxArea0413(int[] height) {
if (height == null || height.length <= 1) {
return 0;
}
int i = 0, j = height.length - 1;
int hi = height[i], hj = height[j];
int max = Math.min(hi, hj) * (j - i);
while (i < j) {
if (hi <= hj) {
i++;
while (height[i] <= hi && i ... |
88f8401f-4303-4a01-8efc-0c7846bb8d58 | 8 | public static List<Rule> generateRulesForRole(RoleType role)
{
// For all the powers and commitments
// of the roles of an org, generate the rules
List<Rule> rules = new ArrayList<Rule>();
//Translate Powers
List<PowerType> powers = role.getPower();
for (PowerType power : powers) {
Rule rule = ne... |
4d929f4c-39de-4484-8bbc-c5f28a865067 | 2 | public static void main(String args[]) {
int month ;
SavingsAccount saver1 = new SavingsAccount(2000);
SavingsAccount saver2 = new SavingsAccount(3000);
System.out.println("Set annualInterestRate to 4% ");
SavingsAccount.modifyInterestRate(.04);
System.out.println("Saving Balance:\nMonth\tsaver1\tsaver2")... |
89f50e36-3524-4242-aaf8-cadc6cd1365e | 2 | public Portal(int id) {
super(false,true, 32, 32, "res/objects/portal.png");
this.id = id;
if(id%2 == 0){
targetId = id-1;
}
if(id%2 == 1){
targetId = id+1;
}
} |
6d671c0a-43cd-4c97-b634-6fb734cbf80f | 5 | public static byte[] encode(
byte[] data)
{
byte[] bytes;
int modulus = data.length % 3;
if (modulus == 0)
{
bytes = new byte[4 * data.length / 3];
}
else
{
bytes = new byte[4 * ((data.length / 3) + 1)];
}
int dataLength = (data.length - modulus);
int a1, a2, a3;
for (int i = 0, j... |
94c8663b-9401-4d7f-9280-e0f280afd7fd | 2 | public static void disposeFonts() {
// clear fonts
for (Font font : m_fontMap.values()) {
font.dispose();
}
m_fontMap.clear();
// clear bold fonts
for (Font font : m_fontToBoldFontMap.values()) {
font.dispose();
}
m_fontToBoldFontMap.clear();
} |
a5d7f917-d140-40c9-bc81-026d30dc52d2 | 2 | public void addSuccessor(Jump jump) {
SuccessorInfo info = (SuccessorInfo) successors.get(jump.destination);
if (info == null) {
info = new SuccessorInfo();
info.jumps = jump;
if (jump.destination != END_OF_METHOD)
jump.destination.predecessors.add(this);
successors.put(jump.destination, info);
} ... |
e78230b6-8847-434f-bf88-3d2c16b5c344 | 3 | private int underlineHandler(char[] chars, int i) {
basicText.append("\\u ");
String plainWord = "";
while (chars[i] != ' ') i++;
i++;
while (chars[i] != '}' && i < chars.length) {
plainWord = plainWord + chars[i];
i++;
}
basicText.append(... |
a1cb91b4-b491-4141-b358-9d84b6b622f0 | 6 | @Override
public int hashCode() {
int result = javaType != null ? javaType.hashCode() : 0;
result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (parsimoniousStorage ? 1 : 0);
result = 31 * result + (indexes != null ? indexes.hashCode() : 0);
result = 31 * result + (k... |
487f39f8-9985-4863-b8a5-fe9491b4186e | 6 | @Override
public void delete(String path) throws IOException {
PrintWriter out = null;
String info = null;
if (Hdfs.Core.DEBUG) {
out = new PrintWriter(new BufferedWriter(new FileWriter("delete.log", true)));
info = String.format("%s[request]:\t%s\n", new Date().toString(), path);
out.write(info);
... |
8938de04-28b6-4dfe-a275-2ca6d5c1ca5a | 5 | public static List<Position> getAdjucentPositionsBack(Position box, State currentState) {
// the row and column of this box
int row = box.getRow();
int col = box.getCol();
// the list to be returned with the valid adjucent positions
List<Position> adjucent = new ArrayList<>()... |
17624b75-f6bd-4c3b-b22d-48c34ea7b630 | 1 | public Session(NioServer server, SocketChannel channel, SSLContext sslContext, Personality personality) throws SSLException {
mServer = server;
mChannel = channel;
mAddress = channel.socket().getInetAddress();
mRequests = new LinkedList<>();
mId = NEXT_ID.incrementAndGet();
if (sslContext != null) {
mSSL... |
5f7e8b48-9d2d-412b-a5ce-fc06fbc30c14 | 6 | private static Image getImage(String filename) {
// to read from file
ImageIcon icon = new ImageIcon(filename);
// try to read from URL
if ((icon == null) || (icon.getImageLoadStatus() != MediaTracker.COMPLETE)) {
try {
URL url = new URL(filename);
... |
d8cf6345-31e1-42aa-a122-1097aa1fd3b5 | 2 | public NBTTagCompound getNBTTagCompound(String key) {
try {
if(hasKey(key))
return (NBTTagCompound) this.get(key);
return new NBTTagCompound();
} catch (ClassCastException e) {
return new NBTTagCompound();
}
} |
62b98abf-f238-4a0e-b634-7d2f85602968 | 8 | public int findString(String target, String[] data, int accumulated){
if(data.length==0) return -1;
if(data.length==1){
if(data[0].equals(target)) return accumulated;
return -1;
}
int pivot = data.length/2;
int tempPivot = pivot;
int change = 1;
while(data[tempPivot].equals("")){
//search for non... |
36fc2126-69f3-4beb-829f-7ec7bf1e0581 | 9 | @Test
public void testSubtract() {
System.out.println("subtract");
Polynomial<Double, Double, Double> instance = this._instance;
double[] values;
values = new double[4];
for (int i = 0; i < values.length; i++)
values[i] = i + 1.0;
Polynomial<Double, Doub... |
28a01d47-c6dd-4d7e-859f-0b68f4363154 | 3 | int processAsterisk(final Character previousChar, final Character currentChar, final OutStream outStream) throws StreamException {
int mode = MODE_REGULAR;
String buffer = "";
if (previousChar == '/') {
mode = MODE_SLASH_ASTERISK;
} else {
if (previousChar != ' ')... |
fba083db-446e-4bd9-aa2e-11b63159d6d7 | 5 | private int[] findErrorLocations(GenericGFPoly errorLocator) throws ReedSolomonException {
// This is a direct application of Chien's search
int numErrors = errorLocator.getDegree();
if (numErrors == 1) { // shortcut
return new int[] { errorLocator.getCoefficient(1) };
}
int[] result = new int... |
905c7493-599c-409c-b63e-94c7e287a5dd | 4 | public static void loadResources() {
try {
Image img = new Image("images/guysprite.gif", false, Image.FILTER_NEAREST);
SpriteSheet sprite = new SpriteSheet(img, 23, 32);
PlayerEntity.STAND_ANIMATIONS = new Animation[4];
for(int i = 0; i < 4; i++) {
PlayerEntity.STAND_ANIMATIONS[i] = new Animation(spri... |
1577881f-a0bd-4dbf-b09e-0b91b64c401a | 9 | private boolean r_verb_suffix() {
int among_var;
int v_1;
int v_2;
int v_3;
// setlimit, line 174
v_1 = limit - cursor;
// tomark, line 174
if (cursor < I_pV)
{
... |
99725673-7520-4bbe-b6bb-4bfbc2e25b5d | 2 | public Boolean getIsoutByOrdernumber(Statement statement,String ordernumber)//根据订单号获取是否出来(状态)
{
Boolean result = null ;
sql = "select isout from ParkRelation where ordernumber = '" + ordernumber +"'";
try
{
ResultSet rs = statement.executeQuery(sql);
while (rs.next()) {
result = rs.getBoolean("isout... |
0829eb8a-51fc-4217-9cf4-a8d7e0e518bd | 9 | private boolean r_postlude() {
int among_var;
int v_1;
// repeat, line 75
replab0: while(true)
{
v_1 = cursor;
lab1: do {
// (, line 75
// [, line 77
bra = cursor;
... |
d8efc112-0532-4212-8089-f84b024c9756 | 8 | protected void zeroNativeMemory(final long size)
{
if (ptr != 0) {
final int nthreads = (int)Math.min(size, Runtime.getRuntime().availableProcessors());
if (nthreads <= 2 || size < 100000) {
Utilities.UNSAFE.setMemory(ptr, size * sizeof, (byte) 0);
} else ... |
26c124f0-e138-4664-976f-c288055bc6a4 | 0 | public void setProperties(Map<String, Object> properties)
{
this.properties = properties;
} |
4cfc8c6d-9578-4213-bdbb-81b6690643b7 | 7 | private void gameListing() throws IOException{
byte[] command = new byte[4];
int check2 = is.read(command);
if (checkInput(check2))
return;
int nbrGames = Conversions.ByteArrayToInt(command);
for (int i = 0; i < nbrGames; i++) {
check2 = is.read(command);
if (checkInput(check2))
return;
int na... |
e6acfdf2-85fa-4e08-beba-53da05cca049 | 4 | public synchronized Exon getFirstCodingExon() {
if (firstCodingExon == null) {
// Get transcription start position
long cstart = getCdsStart();
// Pick exon intersecting cdsStart (TSS)
for (Exon exon : sortedStrand())
if (exon.intersects(cstart)) firstCodingExon = exon;
// Sanity check
if (fir... |
fdcbd76d-52ed-4d65-b89d-e033ecb8bc71 | 3 | public static boolean inside(int x, int y, int n, int m) {
return x >= 0 && y >= 0 && x < n && y < m;
} |
47c5d0a5-691a-4ffb-9baa-b6cbabc00a97 | 2 | public Value get(Key key) {
for (int i = hash(key); keys[i] != null; i = (i + 1) % M)
if (keys[i].equals(key))
return vals[i];
return null;
} |
9e22212f-b001-4d91-bcc2-cf5b42fc0036 | 0 | public String getEffets() {
return effets;
} |
e3f931f9-0d6d-43bb-b0f8-51b86f7a3ea9 | 1 | public CrawlerConfigurationBuilder withLinkNormalizer(final LinkNormalizer normalizer) {
if (normalizer == null) {
throw new IllegalArgumentException("link normalizer cannot be null");
}
configuration.linkNormalizer(normalizer);
return this;
} |
47a8091c-56e0-44d8-8d38-b2debb36b08e | 3 | public static Source fromStringOrNull(String src) {
if (src == null)
return MISSING;
for (Source v : Source.values())
if (v.oneLetter() == src.charAt(0))
return v;
System.err.println("Unknown Source code [" + src + "]");
return MISSING;
} |
e1a77067-aefa-4755-8022-d543e652b77a | 1 | private void incrementHunger()
{
setFoodLevel(getFoodLevel() - 1);
if(getFoodLevel() <= 0) {
setDead();
}
} |
da1dbd15-0b61-430f-b741-e973d1af17c3 | 4 | @Override
public void render(float interpolation)
{
super.render(interpolation);
texID.render(interpolation);
startX.render(interpolation);
startY.render(interpolation);
dimX.render(interpolation);
dimY.render(interpolation);
framesX.render(interpolation);
framesY.render(interpolation);
paddingX.ren... |
361b49fe-8202-47fa-9b3f-1852cea135b1 | 3 | static long getScaledBase(final long base, final int factor)
{
if (factor == 0)
{
return base;
}
else if (factor > 0)
{
return base * SCALES[factor];
}
else
{
if (-factor >= SCALES.length)
{
return base / SCALES[SCALES.length - 1] / SCALES[-factor - SCALES.length];
}
else
{
return bas... |
a068b11e-a527-452c-93f2-e0307c23d81b | 4 | private void sayCommand(String channel, String sender, String source, String message)
{
if (isCommand("say", message))
{
if (acebotCore.hasAccess(channel, sender, channelAccess, userAccess, accessExceptionMap))
{
if (message.split(" ", 2)[1].startsWith("/") || me... |
8de82845-6937-404b-9067-0673569f2ad6 | 3 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
try {
selectedTenant.setName(jTextField2.getText());
selectedTenant.setAddress(jTextField3.getText());
selectedTenant.s... |
d4bc0f3e-6353-4ab7-bd94-4592856ad9d1 | 4 | public void write(byte[] data, long offset, VDK1FilePattern pattern) {
byte[] resultBuffer = new byte[pattern.getLength()];
try {
seek(offset + pattern.getOffset());
if(pattern.isLittleEndian()) {
for(int i = 0; i < data.length; i++)
resultBuffer[(data.length - 1) - i] = data[i];
} ... |
cf6c4dbb-dddb-40c6-8389-0c17a0f50b04 | 7 | public static Iterator allTrueDependentPropositions(Stella_Object self, Surrogate relation, boolean specializeP) {
if (!((relation != null) ||
(!specializeP))) {
System.err.print("Safety violation: INTERNAL-ERROR: Expected defined relation argument");
}
{ Cons pattern = ((relation != null) ? C... |
388212f1-e7b8-481f-b28f-790e2b6f065e | 7 | private void allocateFiles(String projectFolderPath){
File projectFolder = new File(projectFolderPath);
File[] files = projectFolder.listFiles();
for(File file : files){
try {
FileReader fr = new FileReader(file);
BufferedReader br = new BufferedReader(fr);
String line = br.readLine();
if(line ... |
8f963cd9-07f2-40de-a827-e685e2ec7ad9 | 1 | public void Stop()
{
if(!m_isRunning)
return;
m_isRunning = false;
} |
5d79dab4-e249-44c5-9852-45a4a09a7265 | 0 | public void setSintoma(String sintoma) {
this.sintoma = sintoma;
} |
711b012a-3c0a-4597-b7b5-a8fcd59c0daf | 7 | public void execute() {
if (!pins[1].value && lastClock) {
boolean q = pins[3].value;
if (pins[0].value) {
if (pins[2].value) {
q = !q;
} else {
q = true;
}
} else if (pins[2].value) {
... |
91abdbe1-31ed-4e69-837f-c8b795a23114 | 1 | public void setViewDegree(int viewDegree) {
int difference = viewDegree - this.information.getViewDegree();
if(difference != 0){
rotateImages(difference);
}
this.information.setViewDegree(viewDegree);
} |
0bcf579f-b9da-481b-ad40-d7c1e62fc915 | 2 | public boolean setmes(int mes)
{
if(mes<13&&mes>0)
{
_mes=mes;
return true;
}
else
return false;
} |
e0fbf2b5-8836-45b8-8e02-c89bbaf4c666 | 0 | public void setSeat(int seat) {
this.seat = seat;
} |
7ea77fef-c84b-4522-bb9b-175b20678b54 | 9 | private void checkUpgrades() {
if (jumpMultiplier != 1.0f || speedMultiplier != 1.0f || invulnerable != false) {
long currTime = System.currentTimeMillis();
if (currTime - jumpUpgStart >= JUMP_DURATION) {
jumpMultiplier = 1.0f;
jumpUpgStart = 0;
... |
10d9b43e-1579-4473-90e3-6443c3830c82 | 5 | @Override
public void addShip(String player, int size, int coordinate, Direction direction) throws IllegalArgumentException {
if(player == null || player.length() == 0 || size < 1 || coordinate < 0 || direction == null){
throw new IllegalArgumentException("check input arguments");
}
} |
619b4642-a73f-41e3-baa3-0f6d2385be98 | 4 | @Override
public void run() {
PaperIDList = getResultSet();
String insert = "insert into tf(term,paperid,count,totalcount,tf) values(?,?,?,?,?);";
int record = 0;
try {
SQLconnection connection = new connection().conn();
PreparedStatement statement = connection.conn
.prepareStatement(insert);
int... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.